[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Convert CALS Table
Subject: [xsl] Convert CALS Table From: gregor FELLENZ <gf_public@xxxxxxx> Date: Fri, 18 Feb 2005 20:10:13 +0100 |
hello xsl-list, i have to normalize CALS tables, to another table model which has no colspan resp. rowspan abilities. I have to fill for each omitted entry an empty cell in my new document, to generate valid tables. Realizing this for colspan is no problem (as you can see in my xslt) but i have no idea how to cover the rowspan. The problem is, that i have to insert in every spanned row an empty cell, but how can i gather this information? Any ideas or hints how i can realize this? Thanks gregor *** MY XSLT <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="xml"/> <xsl:template match="table"> <tablex> <xsl:apply-templates/> </tablex> </xsl:template> <xsl:template match="row"> <row> <xsl:for-each select="entry"> <xsl:choose> <xsl:when test="@namest != '' "> <xsl:variable name="temp" select="@nameend"/> <xsl:variable name="ende" select="ancestor::*/colspec[@colname = $temp]/@colnum"/> <cell> <xsl:apply-templates/> </cell> <xsl:call-template name="zellenschreiben"> <xsl:with-param name="anzahl" select="1"/> <xsl:with-param name="ende" select="$ende -position()"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <cell> <xsl:apply-templates/> </cell> </xsl:otherwise> </xsl:choose> </xsl:for-each> </row> </xsl:template> <xsl:template name="zellenschreiben"> <xsl:param name="anzahl"/> <xsl:param name="ende"/> <xsl:if test="$anzahl <= $ende"> <cell/> <xsl:call-template name="zellenschreiben"> <xsl:with-param name="anzahl" select="$anzahl + 1"/> <xsl:with-param name="ende" select="$ende"/> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> *** Source Example, its CALS <table> <tgroup cols="4"> <colspec colnum="1" colname="spycolgen1" colwidth="1.0*"/> <colspec colnum="2" colname="spycolgen2" colwidth="1.0*"/> <colspec colnum="3" colname="spycolgen3" colwidth="1.0*"/> <colspec colnum="4" colname="spycolgen4" colwidth="1.0*"/> <tbody> <row> <entry namest="spycolgen1" nameend="spycolgen3">colspan</entry> <entry>2</entry> </row> <row> <entry morerows="1">rowspan</entry> <entry>4</entry> <entry>5</entry> <entry>6</entry> </row> <row> <entry>7</entry> <entry>8</entry> <entry>9</entry> </row> </tbody> </tgroup> </table> *** Result ... <tablex> <row> <cell>colspan</cell> <cell/><!-- This empty cell comes from the colspan ... --> <cell/> <cell>2</cell> </row> <row> <cell>rowspan</cell> <cell>4</cell> <cell>5</cell> <cell>6</cell> </row> <row> <!-- Here I need another <cell/> to get valid code --> <cell>7</cell> <cell>8</cell> <cell>9</cell> </row> </tablex> -- enforce privacy - http://www.pgpi.org pgp key id: 0x7DBB8BA1 - http://pgp.mit.edu mailto:gf_public@xxxxxxx Freitag, 18. Februar 2005 19:20
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] newbie prob - Template an, Nick Roberts | Thread | Re: [xsl] Convert CALS Table, gregor FELLENZ |
RE: [xsl] the sum value. SOS., JBryant | Date | Re: [xsl] Adding element to xml sni, Nishi Bhonsle |
Month |
Keywords