|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] variables numbers and apply templates
Hi All,
this has kept me busy for an hour or two, have found a solution but I would like to find out what I ran into.
I wrote a recursive template which I pass as a parameter, a number
<xsl:template match="sect1|sect2|sect3|sect4|sect5" mode="createtoc">
<xsl:param name = "TocLevel" />
<xsl:variable name="CurrLevel">toclevel<xsl:value-of select="$TocLevel></xsl:variable>
<xsl:variable name="NextElement" select="concat('sect',$TocLevel+1)"/>
<xsl:element name="{$CurrLevel}">
<xsl:if test="$NextElement">
<xsl:apply-templates select="*[name()=$NextElement]" mode="createtoc">
<xsl:with-param name = "TocLevel" select="$TocLevel+1"/>
</xsl:apply-templates>
</xsl:if>
</xsl:element>
Two things I cant'do
a) <xsl:if test="count($NextElement)>0">
b) <xsl:apply-templates select="$NextElement" mode="createtoc">
I have no idea why I get errors when I try the above
if $NextElement would have been only characters :'secttwo' I would have no problem doing the above.
if I declare the varaible as <xsl:variable name="NextElement" select="sect2"/> it is ok too
I could read out the values with value-of select='$NextElement'
I played around with both versions of declaring the variable to no avail.
Wondering minds need to know....
Regards
Gerrit
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








