Products, list of elements and XML in Indesign

Hi,
I want to do something with XML in Indesign, but I can't find the solution
I have a list of product, and each product is composed of multiple elements, just like that :
A product can be made for exemple like that :
Product 1    :  - P2O5 : 23 g/L
                    - CaO : 1,2 g/L
                    - Zn : 3,2 g/L
Product 2    :  - N : 4,3 g/L
                    - MgO : 2,2 g/L
I want only elements (when I say "element", I want to say Chemical element) that have a face value when I import my XML, and not the other (for exemple, not the term "B", "Cu", ...)
My XML has the value of the elements (for exemple, 23 g/L, 1,2 g/L) but not the term "N", "Cu", ... (it's a static text, directly typed into an anchored object in Indesign)
I want the term "P2O5" or "CaO" to appear only when there are a face value, but disappears when there are no face value.
And I want the elements not to be too spaced one to each other (for exemple, if there not N, P2O5 and K2O elements in my product, the term "MgO" and its value reach back instead of the term"N" (see in my picture above)
For exemple, in this picture (done manually), there is too much space before "CaO : 560", and between "CaO : 560" and "Mn : 8,8"
So, how can I create a document into Indesign with XML (much like in my exemple), wich generates list of products with differents elements that appear or disappear according to their values?
I don't know if my XLM tags are right or not, or if I use the right strategy with anchored blocks instead of a single block of text, but I don't find the solution!
Can someone help me?
I work on Indesign CS6, on Windows 7.
Thank you,

Hello Fabien,
I have had a chance to look at the files. I am a bit uncertain about something. Is the table a design element, or do you want the data in a table?
If you do not want the data in a table, let me know.
If you do want the XML in a table, there are a couple means of achieving that. I don't know how big this publication is going to be, and so the answer sort of depends upon that. So a general "rule" I follow is:
For product data sheets or publications of say 12 pages or less, I will simply arrange my XML so that the data is in rows with the data that will be in a row's cells separated by tabs. I will typically bring in a small amount of data, create the table and create table and cell styles for quickly formatting the data into tables once inside ID. I use the Text to Tables feature for these, then apply the table style(s).
For a bit bigger publication, I will create a CALS table structure in the XML and do the same as above as regards applying table/cell styles.
For a large publication where manually going through and applying the table styles would be onerous and or there are several table styles I would need to use, I *might* take the time to wrap the XML table data in an ID table structure. To see what you would be up against, create and style a table and export it out as an XML file. This, to me, is only worth doing on a really large file that perhaps includes several styles of tables.
Using your example XML, it would look similar to the below. Depending on your text editor, it doesn't take too long to use the search/replace function in a good editor to do once you know how it needs to be laid out and your familiarity with the editor. I began with importing your XML into Excel rearranged some data, exported back out to XML and cleaned it up. I don't know where the data you have is coming from, but if a database of some sort, likely most of this could be done with the export from Access, the SQL, etc. I try to get whoever is providing the XML to get as close as possible to what I need, which takes working with them. But it saves time on my end.
<?xml version="1.0" encoding="utf-8"?>
<stuff>
<table>
<tgroup cols="5">
<colspec colname="1"/>
<colspec colname="2"/>
<colspec colname="3"/>
<colspec colname="4"/>
<colspec colname="5"/>
<thead>
<row>
<entry>Produit</entry>
<entry>Composition</entry>
<entry>Forme</entry>
<entry>Cultures</entry>
<entry>Doses</entry>
</row>
</thead>
<tbody>
<row>
<entry>Produit1</entry>
<entry>560 g/L
8,8 g/L
2,6 g/L</entry>
<entry>Texte Forme
Texte Formulation</entry>
<entry>Texte Cultures</entry>
<entry>Texte doses
Texte application</entry>
</row>
<row>
<entry>Produit 2</entry>
<entry>10 g/L
50 g/L
10,2
27 g/L</entry>
<entry>Texte forme 2
Texte formulation 2</entry>
<entry>Texte cultures 2
Texte doses 2</entry>
<entry>Texte application 2</entry>
</row>
</tbody>
</tgroup>
</table>
</stuff>
Take care, Mike

Similar Messages

  • Would like to create a script for list all elements and structure of an indesign document

    Hello everybody,
    I'm a very beginner in indesign scripting.
    I would like to create a script in order to list all elements and the inner structure of a n indesign document.
    The aim for me is to understand how elements are sorted and arranged into indesign, and be able to find an specific element by its item name.
    The output document could be an xml or txt document with a treeview structure.
    I would like have a rough idea of which kind of javascript code I should use for that.
    Thanks for answers.

    Hi Ossydoc,
    You can use Muse to create such a website. All you need to do is, create links in Muse for the sermons and select  " link to File " in the hyperlink option and link to those Mp3 files.
    Please refer to this screenshot :- http://prntscr.com/4xvdup
    Now, when you publish your site,  Muse would automatically upload those files onto the server and the users would then be able to listen as well as download those sermons using the links on your site.
    Hope this helps
    Regards,
    Rohit Nair 

  • Listing WBS elements and object relations

    Hello Friends,
    I want to output all wbs-elements and attached objects in a list, but I'm not sure how to do this. Is there a standard report for this? In trans cj03 you can only se the relation between one wbs-element and its related objects... I want to view them all. I considered to make a report with quickviewer but I am not sure which tables to connect, as the data-fields in transaction cj03 only reffers to structure fields... I would appreciate any input...
    best regards
    Ballo

    Hi Robert,
    Check out the conversion routine attached to the WBS element, and you need to add code in your program to convert it before downloading.
    If no conversion exit is available, you need to write code to select its mapping from database table.
    cheers
    swastik

  • Product information - photoshop elements and photoshop cc

    Dear Sirs!
    My brother (student - polytechnical school) and I (Student - university) are very interested in your products
    Photoshop CC and Photoshop Elements 13.
    What would you recommend and what are the distinctions?  Would there be a possibilty to buy one of this two products once for 2-3 laptops/PCs
    and in the Student and Teacher Edition? (no monthly subscription)
    Thank you very much in advance for your kindly help!!
    Kind regards
    Kerstin

    Mstina61
    Could you clarify...what is not opening -  Photoshop Elements AND Premiere Elements or just one or the other?
    How did you install these programs, from installation files obtained online from Adobe OR from installation disc from a boxed bundled packaging of Photoshop Elements and Premiere Elements? Do you have purchased serial numbers or are you dealing with the tryouts?
    Please excuse the question, but I do not want to take anything for granted...are you making a distinction between download and install if you are working from installation files obtained onlien from Adobe. In the latter case, after the download, you need to install the program(s) from the Setup.exe that comes with each of the programs.
    Please supply more information and then we can decide on the appropriate troubleshooting strategy.
    Thanks.
    ATR

  • Are there any command can list all container and XML doc which in DB

    When I use BDB XML shell,
    are there any command can list all container or xml document which in database,
    maybe like command dir(in windows), can list all exist directory and file.
    Thank very much.
    Henry Wang

    Hi Henry,
    When I use BDB XML shell,
    are there any command can list all container or xml
    document which in database,
    maybe like command dir(in windows), can list all
    exist directory and file.If you type "help" in the dbxml shell you'll get a list of all the commands available. As you will observe, you can use the "getDocuments" command to retrieve all the documents within a container. You will have to open the container first.
    If you want to list all the files within a directory you'll need to simply use the command prompt's "dir" (naming all your containers within a directory in the <container_name.dbxml> would allow you get the list by running a "dir *.dbxml" command).
    Not sure that this is what you really want, but if you would like to keep track of all the containers within a directory, or other directories, you can use a container with a special role, that of a catalogue, to hold the list of all created containers on disk, and eventually other specific information.
    Regards,
    Andrei

  • How to get the xml element and comment name in a page?

    I need to list all element and comment name in a page

    Hi,
    do
      //K2Vector<XMLReference> allXMLRefs;
                        std::vector<XMLReference> allXMLRefs;
      IActiveContext* context = GetExecutionContextSession()->GetActiveContext();
                        UIDRef documentUIDRef = ::GetUIDRef(context->GetContextDocument());
                        XMLReference rootXMLRef = GetRootXMLReference(documentUIDRef);
                        GetFlattenedElementList(documentUIDRef,allXMLRefs);
                        std::ostringstream os;
                        for(std::vector<XMLReference>::iterator it = allXMLRefs.begin(); it != allXMLRefs.end(); ++it)
                                  XMLReference nextref = *it;
                                  PMString tag_name;
                                  os.str("");
                                  os <<  AsString(nextref,tag_name).GetPlatformString().c_str();
      CAlert::WarningAlert(os.str().c_str());
              }while(kFalse);
    I use above code to get tag name.
    Any one help me to get the comment tag in XML

  • Hello! I had Photoshop Elements (and some other products) installed on my Laptob, but lost them because of a system breakdown. Trying to install these programms again, I logged in to my account "my adobe" and immediately found my products listed there plu

    Hello! I had Photoshop Elements (and some other products) installed on my Laptob, but lost them because of a system breakdown. Trying to install these programms again, I logged in to my account "my adobe" and immediately found my products listed there plus a link "download here". But clicking the link didn´t start anything. Nothing happened. How can I get my prgramms installed again?

    Try using a different browser if the link did not work.
    You can also try downloading thru the following page if you can find the version(s) you need...
    Download and Installation Help -
    https://helpx.adobe.com/download-install.html

  • I am new in indesign scripting, please tell me how to write a script to get  content of a element in xml and then sort all the content

    I am new in indesign scripting, please tell me how to write a script to get  content of a element in xml and then sort all the content

    Hi,
    May the below code is useful for you, but I dont know how to sort.
    Edit the tag as per your job request.
    alert(app.activeDocument.xmlElements[0].contents)
    //Second alert
    var xe = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");
    alert(xe.length)
    for(i=0; i<xe.length; i++)
        alert(xe[i].texts[0].contents)
    Regards
    Siraj

  • How to move some xml element and its content to a new frame

    Hi All,
    How to move some xml element and its content to a new frame.

    Hi Chinnadk,
    Sorry my code its comment some lines. Now only I check the forum thread, you just try one more time.
    #target InDesign;
    #include "/Program Files (x86)/Adobe/Adobe InDesign CS5.5/Scripts/XML Rules/glue code.jsx"
    var myDoc = app.activeDocument;
    //____________________ XML RULE SET
    var myRuleSet = new Array (new margintag);
    with(myDoc){
        var elements = xmlElements;
        __processRuleSet(elements.item(0), myRuleSet);
    function margintag(){
        this.name = "margintag";
        //this.xpath = "//margintag[@type='mn2']";
        this.xpath = "//margintag";
        this.apply = function(myElement, myRuleProcessor){
            with(myElement){
                app.select(myElement);
                try{
                    var myPrePara = app.selection[0].paragraphs[-1].parentTextFrames[0].paragraphs.previousItem(app.selection[0].paragraphs[-1]);
                    if(myPrePara.characters[-1].contents=="\r"){
                        myPrePara.characters[-1].remove();
                    var myTextframe = myElement.placeIntoInlineFrame(["7p9","6p"]);
                    myTextframe.appliedObjectStyle= myDoc.objectStyles.item("MN1");
                    myTextframe.fit(FitOptions.FRAME_TO_CONTENT);
                    myTextframe.parentStory.paragraphs.everyItem().appliedParagraphStyle = app.activeDocument.paragraphStyles.itemByName("MN1");
                    }catch(e){}
                app.selection = null;
            return true;
    thx,
    csm_phil

  • XML and tables in InDesign

    Hi everyone,
    I'm just starting to explore the possibilities of XML in InDesign and in need of some general information:
    The projects that I'm working with that I think would benefit from the XML workflow are files that include a number of tables (e.g., product names, descriptions, prices, etc. with header rows and some merged cells).
    The content of the tables are the same for a brochure-style layout and a poster-style layout but the brochure tables need to be tall and narrow and the poster tables short and wide (basically flipping the axes). So far I've handled this through a complicated dance of exporting the tables as text and using Excel to flip the axes and then import the tables back into InDesign (in order for this to work, I have to un-merge all merged cells and it still isn't perfect but a reasonable starting point).
    The editors make changes to the content in InDesign using InCopy (adding or removing rows or columns to add new products and/or prices, etc.)
    The poster and brochure versions of the file don't need to be live at the same time--they're used at different times of the year so it's a matter of loading the final brochure content into the poster then making any changes to the poster and 6 months later importing the final poster content into the brochure. And the cycle continues.
    Would XML handle well? The little I've read so far about XML and tables indicates that each cell would need to be tagged. This could easily result in mis-tagging a cell which would screw up the content import, right? I'm talking about hundreds (thousands?) of cells.
    And since the structure of the table would be changing due to adding/removing rows/columns, it seems I would need to tag each cell of the tables every time I wanted to import content.
    Am I understanding all this correctly?
    Thanks for your input.

    Hi
    You are right each cell nee to be tagged in XML tables, if you are working with more than hundreds/thousands of cells, be careful in content tagging. adding/removing columns/rows would really affect the structure of the XML and if it need to extract/export the content the structure of XML will not be correct. It is better to avoid XML tables in case of adding/removing columns/rows.

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns="http://3i-infotech.com/Cust_AML_Finacle.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://3i-infotech.com/Cust_AML_Finacle.xsd List_AML_Finacle.xsd">
    <TransactionID>TransactionID</TransactionID>
    <Match>
    <Src_Matched_Field>Src_Matched_Field</Src_Matched_Field>
    <List_Matched_Field>
    <FSFM_Matches>
    <NUMBER>NUMBER</NUMBER>
    <TERROR>TERROR</TERROR>
    <TU>TU</TU>
    <NAMEU>NAMEU</NAMEU>
    <DESCRIPT>DESCRIPT</DESCRIPT>
    <KODCR>KODCR</KODCR>
    <KODCN>KODCN</KODCN>
    <AMR>AMR</AMR>
    <ADDRESS>ADDRESS</ADDRESS>
    <SD>SD</SD>
    <RG>RG</RG>
    <ND>ND</ND>
    <VD>VD</VD>
    <GR>GR</GR>
    <YR>YR</YR>
    <MR>MR</MR>
    <CB_DATE>CB_DATE</CB_DATE>
    <CE_DATE>CE_DATE</CE_DATE>
    <DIRECTOR>DIRECTOR</DIRECTOR>
    <FOUNDER>FOUNDER</FOUNDER>
    <TERRTYPE>TERRTYPE</TERRTYPE>
    </FSFM_Matches>
    <OfacMatchDetails>
    <UID>UID</UID>
    <TITLE>TITLE</TITLE>
    <SDNTYPE>SDNTYPE</SDNTYPE>
    <REMARKS>REMARKS</REMARKS>
    <ID_UID>ID_UID</ID_UID>
    <IDTYPE>IDTYPE</IDTYPE>
    <IDNUMBER>IDNUMBER</IDNUMBER>
    <IDCOUNTRY>IDCOUNTRY</IDCOUNTRY>
    <ISSUEDATE>ISSUEDATE</ISSUEDATE>
    <EXPIRATIONDATE>EXPIRATIONDATE</EXPIRATIONDATE>
    <ADDRESS1>ADDRESS1</ADDRESS1>
    <ADDRESS2>ADDRESS2</ADDRESS2>
    <ADDRESS3>ADDRESS3</ADDRESS3>
    <CITY>CITY</CITY>
    <STATEORPROVINCE>STATEORPROVINCE</STATEORPROVINCE>
    <POSTALCODE>POSTALCODE</POSTALCODE>
    <COUNTRY>COUNTRY</COUNTRY>
    </OfacMatchDetails>
    </List_Matched_Field>
    </Match>
    </List_AML_Finacle>

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5249519

  • How do I re-install my Adobe products, Acrobat 9 Pro and Photoshop elements 8 on my new PC?

    How do I re-install my Adobe products, Acrobat 9 Pro and Photoshop elements 8 on my new PC?

    Use below link to download the products
    Download Acrobat products | 9, 8
    Download Photoshop Elements products | 9, 8, 7

  • [JS-CS4] - How to read the XML Element and its Attributes

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear All,
      I have the doubt regarding: reading the xmlElement and its attributes.
    Here I droping the xml script
    //============= Start ======================//
    var myDoc = app.activeDocument;
    var Fpath = File("../Projects/Entity_map.xml");
      if (Fpath.exists)
       Fpath.open("r");
       var Cont= Fpath.read();
      var roots = new XML(Cont);
      var myEveryName = new Array();
      var myEveryContent = new Array();
      var myEveryAttributes = new Array();
      traverse(roots);
    //$.writeln(myEveryName);
    //$.writeln(myEveryContent);
    $.writeln(myEveryAttributes.length);
    for(var i=0; i<myEveryAttributes.length; i++)
      $.writeln(myEveryAttributes[i]);
    function traverse(tree) {
        myEveryName.push(tree.name());
    myEveryContent.push(tree.text());
      myEveryAttributes.push(tree.getAttribute);
    // you get the contents by using .text() insted of .name()
        if(tree.elements().length() > 0) {
            for(var i=0; i<tree.elements().length(); i++) {
                traverse(tree.elements()[i]);
    //============== End =====================//
    and the XML Structure is
    //===============XML =====================//
    <?xml version="1.0" encoding="UTF-8"?>< Entity_Convertion>
    < Entitys char="Ç" GID="173"/></ 
    Entity_Convertion>
    //===============End ====================//
    Here I'm getting the XML Elements and its contents, but not xmlAttributes.
    Please any one can help me, then I will appreciate...
    Thanks & Regards
    T.R.Harihara SudhaN

  • Xml attributes - importing and displaying in InDesign document to print

    Hello! I am importing XML into InDesign. I need to display the metadata within the attributes in the document that will be printed . For example, if I'm creating a lesson plan and the "Toady's Lesson" tag has the attributes of: "lesson 2", "Day 2", "Read pages 3-5". I want those attributes to display under "Today's Lesson."  Is it possible to this with InDesign? I did not write this code so there's nothing I can do on that end, I have to work with what was given to me. I've been looking into this for a couple of days and can't find anything on this topic. I would greatly appreciate your help with this!
    thanks!!

    Hi
    You are right each cell nee to be tagged in XML tables, if you are working with more than hundreds/thousands of cells, be careful in content tagging. adding/removing columns/rows would really affect the structure of the XML and if it need to extract/export the content the structure of XML will not be correct. It is better to avoid XML tables in case of adding/removing columns/rows.

  • I can't log in the App store because an from Zambia which is not listed in Apple outlets. How do i go around this as apple products are using globally and not only in the listed countries. My product is a Mac book pro.

    I can't log in the App store because am from Zambia which is not listed in Apple outlets. How do i go around this as apple products are used globally and not only in the listed countries. My product is a Mac book pro. i feel this limits how i can use my product

    Unfortunately you have taken an Apple product outside of the area where Apple currently does business. There isn't legally a way around this. Apple cannot license apps to you where you currently live.

Maybe you are looking for