Subject: [xsl] looping in xslt From: "Joeri Belis" <joeri.belis@xxxxxxxxxxxx> Date: Thu, 29 Apr 2004 15:11:43 +0200 |
I have a big xml file that comes out of a db ( + 3Mb ). It contains a lot of date values. My xslt transformation needs to create a new xml file from this dump xml file and add lines for every date just ones. So the file may contain 100 date values but only 10 different dates ( this example has 5 dates but only 3 different dates ) <?xml version="1.0"?> <root> <rec> <date><value>010104</value></date> </rec> <rec> <date><value>010104</value></date> <date><value>020104</value></date> </rec> <rec> <date><value>020104</value></date> <date><value>030104</value></date> </rec> </root> 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. 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? Or there any other solutions ? i use xlst 1.1. Thank you, Joeri
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using XPath to retrieve n, Christopher R. Maden | Thread | RE: [xsl] looping in xslt, Kenny Akridge |
[xsl] Using XPath to retrieve nodes, Manuel Reyes | Date | RE: [xsl] Add attribute to all node, Michael Kay |
Month |