[Bug 4400] Allow xsl:variable before xsl:sort

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4400





------- Comment #1 from mike@saxonica.com  2007-03-20 16:41 -------
Thanks for the comment. We haven't really started any serious work yet towards
gathering requirements for a future version of XSLT, but no doubt this
suggestion will get added into the list for consideration. 

The idea seems to take one a step closer to reproducing the XQuery FLWOR
expression in XSLT. In XQuery it would be written:

for $x in /foo/bar
let $item := document('items.xml')//item[@xml:id = $x/@code]
order by $item/label
return $item/@a, $item/@z

In your particular example (and in most practical examples) I think there are
straightforward workarounds. Here I would do:

<xsl:key name="k" match="item" use="@xml:id"/>

then

<xsl:for-each select="/foo/bar/key('k', @code, document('items.xml'))">
<xsl:sort select="label"/>
<xsl:value-of select="@a"/>
<xsl:value-of select="@z"/>

This is a personal response.

Received on Tuesday, 20 March 2007 16:42:10 UTC