Subject: RE: [xsl] XSL - using for-each with sort - can't access previous sorted nod e From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 25 Nov 2003 23:26:12 GMT |
actually it's surprisingly dificult in pure xslt 1 to sort and process (or query) at the same time. Almost all processors provide a node-set() extension function which makes things much easier. First sort: <xsl:variable name="x"> <xsl:for-each select="question"> <xsl:sort... <xsl:copy-of select="."/> </xsl:for-each> <xsl:variable> Now $x is essentially your sorted list and in xslt2 (or xslt 1.1 draft) you'd be able to apply templates to that, but in xslt1.0 it's a result tree fragment that can be copied to the output but not queried. But assuming you have x:node-set() in your processors extension namespace you can do <xsl:apply-templates select="x:node-set($x)/question"/> and then the previous question is just preceding-sibling::question[1] as usual as your (new) input is sorted. David -- http://www.dcarlisle.demon.co.uk/matthew XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL - using for-each with, Wickersty, Jeff | Thread | RE: [xsl] XSL - using for-each with, Wickersty, Jeff |
Re: [xsl] Recursive walk up tree, dinesh | Date | Re: [xsl] XSL - using for-each with, Wendell Piez |
Month |