Subject: [xsl] Indesign table again From: e107lac <e107lac@xxxxxxxxx> Date: Thu, 30 Aug 2007 14:18:18 +0200 |
<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()) = ''"> </xsl:if> </xsl:element> </xsl:template>
<xsl:template match="@aid:ccols"> <xsl:attribute name="colspan"> <xsl:value-of select="."/> </xsl:attribute> </xsl:template>
<xsl:template match="@aid:crows"> <xsl:attribute name="rowspan"> <xsl:value-of select="."/> </xsl:attribute> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Unicode and <xsl:characte, Andrew Welch | Thread | [xsl] Different regex behaviour on , AAS Contractor |
Re: [xsl] xsl:choose and xsl:when, Abel Braaksma | Date | [xsl] Different regex behaviour on , AAS Contractor |
Month |