|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: cannot assign val to sort key
alex <shortestpath@xxxxxxxxx> wrote:
> From an asp page I pass values for sort key and sort
> order. [...] But I can't seem to assign assign the values
> of these variables to my <xsl:sort>. Here's what I'm
> doing:
>
> <xsl:sort select="$sortKey" order="{$sortOrder}" />
You expect the processor to evaluate the sort key expression twice,
which doesn't happen. The processor evaluates $sortKey and gets
whatever you assigned the variable, it wont evaluate this again
just because it looks like the selection expression you want
it to have used.
To work around this, if you have only simple element names there,
you can use select="*[name()=$sortKey]". This is a FAQ BTW, check
the archives. You probably also want to check the documentation
of your processor whether and how an evaluate() function is
supported.
Your sort order should work fine, you just didn't notice because
with your code all elements get the same sort key and therefore
always stay in document order.
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








