2 Replies Latest reply on Feb 16, 2012 12:51 PM by vyache01

    XML InDesign Table Container

    vyache01

      Hi,

       

      I know this topic was asked so many times, but I've been looking for a more specific answer.

       

      I want to know how to create an XML table that is placed into a container, which will allow me to set wrapping. It’s more of an anchored object on top of the main container.

       

      I've created a working template, which uses XML automation techniques.

       

      For example I have the following code:

       

       

      
      
      <Table>
      
      
      
      
      <threeColumn xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="3" aid:tcols="12">
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Serie</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Total</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Hombre</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Mujer</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">12-18 anos</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">19-25 anos</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">26-34 anos</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">35-44 anos</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45-64 anos</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Bajo</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Medio</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Alto</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">2000</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">49.5</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">53.4</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45.6</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.6</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">62.4</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">56.5</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">54.8</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.3</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">50.9</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.3</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.5</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">2000</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">49.5</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">53.4</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45.6</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.6</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">62.4</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">56.5</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">54.8</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.3</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">50.9</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.3</Cell>
      
      
      
      
      
      
      <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.5</Cell>
      
      
      
      
      </threeColumn>
      
      
      </Table>
      
      
      
      
      
      

       

      Looking above, the table is contained inside the table tag. Now say I want to take this piece of code and move it in to a deeper layer of XML:

       

      <agency_container>
                          <agency_name>City Council</agency_name>
                          <article>
                                    <div_name></div_name>
                                    <article_type>Public Hearings</article_type>
                                    <article_catogory></article_catogory>
                                    <short_title>Vivamus molestie pharetra porta.</short_title>
                                    <article_paragraph>
                                              <paragraph>Quisque tristique purus sit amet leo pretium imperdiet. Nam nisl est, mollis a tincidunt nec, auctor ut magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris suscipit egestas eleifend. Pellentesque quis adipiscing elit. Ut nunc massa, fermentum nec elementum at, pellentesque at mi. Etiam viverra, justo in volutpat viverra, justo dui consectetur arcu, sit amet mattis dui ante tristique augue. Aliquam erat volutpat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas quis eros mi, eget semper eros. Donec sit amet quam ac massa congue sollicitudin. Nulla lorem ligula, scelerisque ut gravida in, volutpat sed nibh. Maecenas nibh est, scelerisque in aliquam et, ultrices non urna. Fusce lacus risus, feugiat in porta in, feugiat vel arcu. Vivamus sed nisl id purus ullamcorper sollicitudin. Aenean eget mi massa. Nullam egestas, quam sed egestas accumsan, velit orci ultrices enim, tincidunt pellentesque nulla orci nec felis.</paragraph> 
                                    </article_paragraph>
                                    <article_paragraph>
                                              <paragraph>
                                                        <one>Use the following address unless otherwise specified in notice, to secure, examine or submit bid/proposal documents, vendor pre-qualification and other forms; specifications/blueprints; other information; and for opening and reading of bids at date and time specified above.</one>
                                              </paragraph>
                                              <paragraph>
                                                        <two>HOUSING PRESERVATION &amp; DEVELOPMENT, ACCO Office of Legal Affairs, HPD 100 Gold Street, 8th Floor, Room 8S6, New York, NY 10038. Lynn Lewis (212) 863-6140; Fax: (212) 863-5455; Email: dl@hpd.nyc.gov</two>
                                              </paragraph>
                                    </article_paragraph>
                          <Table>
                          <threeColumn xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="3" aid:tcols="12">
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Serie</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Total</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Hombre</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Mujer</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">12-18 anos</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">19-25 anos</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">26-34 anos</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">35-44 anos</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45-64 anos</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Bajo</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Medio</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">Alto</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">2000</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">49.5</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">53.4</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45.6</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.6</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">62.4</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">56.5</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">54.8</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.3</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">50.9</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.3</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.5</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">2000</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">49.5</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">53.4</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">45.6</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.6</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">62.4</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">56.5</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">54.8</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">38.3</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">50.9</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.3</Cell>
                                    <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="54.00000000000001">48.5</Cell>
                          </threeColumn>
                </Table> 
                                    <article_image href="file://images/afghan.jpg"/> 
                                    <pub_date>09/27/2011 – 10/03/2011</pub_date>
                          </article>
                </agency_container>
      
      

       

      When I import this into my structure, I notice that it’s only Tagged and not in its own container. This creates a problem because if the table spans over 2 columns it writes over the content.

       

      How do I remedy this?

       

      I don't want to make a separate root or move the copy the table from the end of the document; the table should appear where it’s placed in the XM, in its own container and therefore reflect in the InDesign template.