Subject: Re: [xsl] looping in xslt From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 29 Apr 2004 15:00:40 +0100 |
Hi Joeri, > to find these unique dates i use > <xsl:key name="mydates" match="date" use="value"/> > and to loop 3 times i use. > <xsl:for-each select="/root/rec/date[generate-id() = > generate-id(key('mydates',value)[1])]"> > > I need to loop multiple times so i repeat the "for-each" multiple > times in my code. Is there a way to avoid this. It takes a long time > to find all the unique dates again and again. Store the unique dates in a variable, and then do the <xsl:for-each> selecting the variable: <xsl:variable name="unique-dates" select="/root/rec/date[generate-id() = generate-id(key('mydates', value)[1])]" /> <xsl:for-each select="$unique-dates"> ... </xsl:for-each> <xsl:for-each select="$unique-dates"> ... </xsl:for-each> <xsl:for-each select="$unique-dates"> ... </xsl:for-each> > Can i store a count <xsl:for-each > select="count(/root/rec/date[generate-id() = > generate-id(key('mydates',value)[1])])"> in a variable and use this > in a loop? You can, but I'm not sure that you want to unless you want to output the number of unique dates? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] looping in xslt, Kenny Akridge | Thread | [xsl] search and replace, Norma Yeazell |
Re: [xsl] search and replace, Jeni Tennison | Date | Re: [xsl] Sort by Parameters-Child , David Carlisle |
Month |