This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: unable to dynamically set sort order
- To: hydbad at hotmail dot com
- Subject: [xsl] Re: unable to dynamically set sort order
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- Date: Mon, 21 May 2001 21:37:28 -0700 (PDT)
- Cc: xsl-list at lists dot mulberrytech dot com
- Reply-To: xsl-list at lists dot mulberrytech dot com
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