3 Replies Latest reply on Jun 5, 2016 11:21 PM by Cari Jansen

    Tagging table for XML export

    aliceell Level 1

      I'm trying to tag this table in InDesign but it keeps tagging this table by rows instead of columns.

       

      table.png

       

      When I select the table and use the "AutoTag" feature, this is the resulting XML:

       

      <Table>
        <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="2" aid:tcols="9">
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">TOTALS</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3,329</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">4,861</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9,766</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">2,428</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">1,889</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3,605</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">10,857</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">8,923</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">46,658</Cell>
        </Table>
      </Table>

       

      It's basically tagging the first row and then the second row. However, I would like it to tag column-by-column, not row-by-row:

       

      <Table>
        <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="2" aid:tcols="9">
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3,329</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">4,861</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9,766</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59Am</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">2,428</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">1,889</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3,605</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">10,857</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59pm</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">8,923</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">TOTALS</Cell>
        <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">46,658</Cell>
        </Table>
      </Table>

       

      But I can't seem to tag individual columns. When I highlight the column as seen in the first picture, there is no option to tag it. And there's no way to rearrange the cells in Structure view when I autotag the table. I'm using CS6 on a Windows machine.

        • 1. Re: Tagging table for XML export
          Cari Jansen Adobe Community Professional

          The row by row formatting, with inclusion of row and col ranges, is how InDesign's XML table module works.

           

          If you want the resulting XML to show content column by column in the XML stream you generate, you'd need to create an XSLT that transforms the XML generated by InDesign's into your preferred XML output.

           

          XSLT basically is a set of rules you apply to an XML file that converts the XML file into another XML (or even HTML) based format. See also XSLT Tutorial for more info.


          Cari

          • 2. Re: Tagging table for XML export
            aliceell Level 1

            Thanks very much. I'll look into that, but I'd rather not add another step to my workflow if I can avoid it...

             

            Is it possible to tag individual rows in an InDesign table, then? Say I want to assign the top row to have a "Header" tag, that's nested outside of the table cells:

             

            <Table>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59Am</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59Am</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59Am</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59Am</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">12:00-2:59pm</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3:00-5:59pm</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">6:00-8:59pm</Cell>

              <Header aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">9:00-11:59pm</Cell> 

              <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="2" aid:tcols="9">

              <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">TOTALS</Cell>

              <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">3,329</Cell>

              <Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="29.99">4,861</Cell>

             

            etc. where the "Header" tags are the first two rows of cells in a table.

             

             

            • 3. Re: Tagging table for XML export
              Cari Jansen Adobe Community Professional

              Cells that are header row cells are marked by the inclusion of aid:theader="" attribute with in the Cell element.

               

              <Cell aid:table="cell" aid:theader="" aid:crows="1" aid:ccols="4" aid:ccolwidth="134">Table heading here</Cell>
              

               

              I wrote a reference guide for XML in InDesign with some samples in it a while back, that might be helpful.

              It's posted here: http://carijansen.com/indesign-xml-part-2/

               

              Cari