[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Indesign table again

Subject: Indesign table again
From: e107lac <e107lac@xxxxxxxxx>
Date: Thu, 30 Aug 2007 14:18:18 +0200
 Indesign table again
Hi list!

I hate Adobe Indesign generated table xml. I have already a solution for the grouping of rows. But now the table have rowspan also, and if I transform the xml the HTML is breaking up. Has anyone a general solution for this table, or could someone help me, how can I do it. I'm ready to pay for the solution.

Thank you!

Indesign XML (Table):
<Root>
<Text>
<Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="7" aid:tcols="3">
<Cell aid:table="cell" aid:crows="1" aid:ccols="3">
<CellHeading>SituaC'C#o do BeneficiC!rio/Taxas de BonificaC'C#o</CellHeading>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>
<CharBold>Idade</CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="2">
<CellBodyCenter>
<CharBold>Carreira Contributiva (em anos)/Mensal</CharBold>
</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>&lt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>CondiC'C5es de Acesso C PensC#o sem PenalizaC'C#o</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="98.93438079914081">
<CellBodyCenter>0,65%</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="3" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>&gt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>15 a 24</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="4" aid:ccols="1" aid:ccolwidth="98.93438079914081">
<CellBodyCenter>0.33%b)</CellBodyCenter>
<CellBodyCenter>0.5%b)</CellBodyCenter>
<CellBodyCenter>0.65%b)</CellBodyCenter>
<CellBodyCenter>1.0%</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>25 a 34</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>35 a 39</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>&gt; 65</CellBodyCenter>
</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="78.09186111410146">
<CellBodyCenter>&gt; 40</CellBodyCenter>
</Cell>
</Table>
</Text>
</Root>



The XSL:


   <xsl:key name="row" match="Cell"
       use=
       "
       concat
       (
       generate-id(..),'|',
       floor
       (
       sum(preceding-sibling::Cell/@aid:ccols) div
       ../@aid:tcols
       )
       )
       "/>

   <xsl:template match="Table">
       <xsl:element name="table">
           <xsl:if test="@aid:table = 'table'">
               <xsl:attribute name="border">1</xsl:attribute>
           </xsl:if>
           <xsl:call-template name="rows">
               <xsl:with-param name="start" select="0"/>
               <xsl:with-param name="end" select="@aid:trows"/>
           </xsl:call-template>
       </xsl:element>
   </xsl:template>

   <xsl:template name="rows">
       <xsl:param name="start"/>
       <xsl:param name="end"/>
       <xsl:choose>
           <xsl:when test="$start = $end">
               <xsl:element name="tr">
                   <xsl:apply-templates
                       select=
                       "
                       key('row',concat(generate-id(),'|',$start))
                       "/>
               </xsl:element>
           </xsl:when>
           <xsl:otherwise>
               <xsl:variable name="mid"
                   select="$start + floor(($end - $start) div 2)"/>
               <xsl:call-template name="rows">
                   <xsl:with-param name="start" select="$start"/>
                   <xsl:with-param name="end" select="$mid"/>
               </xsl:call-template>
               <xsl:call-template name="rows">
                   <xsl:with-param name="start" select="$mid + 1"/>
                   <xsl:with-param name="end" select="$end"/>
               </xsl:call-template>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

   <xsl:template match="Cell[CellHeading]">
       <xsl:element name="th">
           <xsl:apply-templates select="@aid:ccols"/>
           <xsl:apply-templates select="@aid:crows"/>
           <xsl:apply-templates select="CellHeading/text()"/>
       </xsl:element>
   </xsl:template>

   <xsl:template match="Cell">
       <xsl:element name="td">
           <xsl:apply-templates select="@aid:ccols"/>
           <xsl:apply-templates
               select=".//text()[normalize-space() != '']"/>
           <xsl:if test="normalize-space(text()) = ''">&#160;</xsl:if>
       </xsl:element>
   </xsl:template>

<xsl:template match="@aid:ccols[. = 1]"/>

   <xsl:template match="@aid:ccols">
       <xsl:attribute name="colspan">
           <xsl:value-of select="."/>
       </xsl:attribute>
   </xsl:template>

<xsl:template match="@aid:crows[. = 1]"/>

   <xsl:template match="@aid:crows">
       <xsl:attribute name="rowspan">
           <xsl:value-of select="."/>
       </xsl:attribute>
   </xsl:template>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.