[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: cannot assign val to sort key

Subject: Re: cannot assign val to sort key
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Sat, 09 Feb 2002 16:53:41 +0100
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.