Subject: RE: [xsl] FW: problem integrating xsl iteration From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx> Date: Mon, 27 Sep 2004 17:46:57 +0100 |
> which would be something like > > <xsl:template match="TotalPages"> > <xsl:param name="x" select="."/> > <xsl:if test="$x != 1"> > <xsl:apply-templates select="."/> > <xsl:with-param name="x" select="$x - 1"/> > </xsl:apply-templates> </xsl:if> <a > href="page{$x}.html"><xsl:value-of select="$x"/></a> </xsl:template> A potential (non head-recursive :) XSLT 2.0 solution would be: <xsl:template match="TotalPages"> <xsl:for-each select="for $i in 1 to . return $i"> <a href="page{.}.html"><xsl:value-of select="."/></a> </xsl:for-each> </xsl:template> I'm still learning v.2.0 things - can this all be done in a single xpath (create the element and the attribute)? cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] FW: problem integrating x, Michael Kay | Thread | [xsl] Re: Namespaces, params and Xa, Fraser Crichton |
RE: [xsl] Expanding XML navigation, Alex | Date | Re: [xsl] XSLT, XML and Identity tr, Anton Triest |
Month |