W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2007

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

From: <bugzilla@wiggum.w3.org>
Date: Tue, 20 Mar 2007 16:41:57 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1HThPJ-00072i-LD@wiggum.w3.org>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:32 UTC