|
Subject: Re: [xsl] Inserting Title before Tgroup and Creating Spans From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 9 Jan 2009 14:03:53 GMT |
It's difficult to follow your code withso many ifs, you should let
template application do teh work for you;
<entry>
<xsl:if test="./@align">
<xsl:attribute name="align">
<xsl:value-of select="./@align"/></xsl:attribute>
</xsl:if>
<xsl:if test="./@valign">
<xsl:attribute name="valign">
<xsl:value-of select="./@valign"/></xsl:attribute>
</xsl:if>
<xsl:if test="./@width">
<xsl:attribute name="width">
<xsl:value-of select="./@width"/></xsl:attribute>
</xsl:if>
<xsl:if test="./@class">
<xsl:attribute name="class">
<xsl:value-of select="./@class"/></xsl:attribute>
</xsl:if>
<xsl:if test="./@rowspan">
<xsl:attribute name="morerows">
<xsl:value-of select="./@rowspan"/></xsl:attribute>
</xsl:if>
<xsl:if test="./@colspan"><xsl:variable
name="colcount"><xsl:value-of select="@colspan"/></xsl:variable>
<xsl:variable name="colstart"
select="count(preceding-sibling::td)"/>
<xsl:attribute
name="namest"><xsl:text>col</xsl:text><xsl:value-of select="$colstart +
1"/></xsl:attribute>
<xsl:attribute
name="nameend"><xsl:text>col</xsl:text><xsl:value-of select="$colstart +
$colcount"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates/></entry>
can be written as
<entry>
<xsl:apply-templates select="@*|node()/>
</entry>
together with
<xsl:template match="@*">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="@rowspan">
<xsl:attribute name="morerows">
<xsl:value-of select="@rowspan - 1"/> <!-- you need - 1 here don't you? -->
</xsl:attribute>
</xsl:template>
<xsl:template match="@colspan">
<xsl:variable name="colcount" select="@colspan"/>
<xsl:variable name="colstart" select="count(preceding-sibling::td)"/>
<xsl:attribute name="namest"><xsl:text>col</xsl:text><xsl:value-of select="$colstart +
1"/></xsl:attribute>
<xsl:attribute name="nameend"><xsl:text>col</xsl:text><xsl:value-of select="$colstart +
$colcount"/></xsl:attribute>
</xsl:template>
> <xsl:for-each select="/descendant::tr[1]
that's searching teh whol edocument, I suspect you wanted
./descendant::tr[1]
To stop the TITLE text appearing twice, just have a template that
doesn't copy it
<xsl:template match="caption"/>
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Inserting Title before Tgroup, Charles Flanders | Thread | Re: [xsl] Inserting Title before Tg, Wendell Piez |
| [xsl] Inserting Title before Tgroup, Charles Flanders | Date | [xsl] Strange error: Unknown collat, peter verhaar |
| Month |