[Home] [By Thread] [By Date] [Recent Entries]
On 3/16/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
Hi XSLT'ers,
<xsl:stylesheet version="2.0" xmlns:seq="seq" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:function name="seq:number" as="xs:integer"> <xsl:variable name="node"><xsl:comment /></xsl:variable> <xsl:sequence select="xs:integer(substring(generate-id($node), 2)) - 1" /> </xsl:function> <xsl:function name="seq:number2" as="xs:integer?"> <xsl:variable name="node"><xsl:comment /></xsl:variable> <xsl:message><xsl:copy-of select="$node"/></xsl:message> <xsl:sequence select="()"/> </xsl:function> <xsl:template match="/"> <xsl:sequence select="for $x in (1 to 10) return if ($x mod 2 = 1) then seq:number() else seq:number2()"/> </xsl:template> </xsl:stylesheet> This calls a different function in between calls to your function that creates nodes which increment the number returned by generate-id() (it uses xsl:message to force the variable to be evaluated) , which makes the output: 1 4 7 10 13 cheers andrew
|

Cart



