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

Re: unable to dynamically set sort order

Subject: Re: unable to dynamically set sort order
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 21 May 2001 21:37:28 -0700 (PDT)
set sort
This must be a FAQ!:

All attributes of xsl:sort with the exception of "select" can be specified as AVT-s.

The "select" attribute can be any XPath expression. Certainly, an attempt to put an
XPath expression in a variable and pass this variable as the (complete) value of the
"select: attribute -- this will fail for xsl: sort as in any such attempt in XSLT,
because XPath expressions are not evaluated dynamically.

However, if you need to specify the name of a child element, then you can use an
expression like this:

*[name()=$sortColumn]

Therefore, one possible way to achieve your wanted results is:

<xsl:sort order="{$order}" select="*[name()=$sortColumn]"/>

Cheers,
Dimitre Novatchev.

bharat chintapally wrote:

Hello All:
          I am trying to dynamically set sort order and sort column in my 
XSLT. It seems that I can not use an expression for "order".

<xsl:apply-templates select="Uow">
   <xsl:sort select="$sortColumn" order="$sortOrder"/>
   <xsl:with-param name="from" select="$startRow"/>
   <xsl:with-param name="to" select="$endRow"/>
</xsl:apply-templates>

** $sortColumn and $sortOrder are variables here

Is there any other way I can solve this issue? The reason I need to do this 
is to keep track of users preference between requests when they are 
sorting..

Any ideas or help is really appreciated..

Thanks



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 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.