xsl-list
[Top] [All Lists]

RE: Re: <xsl:sort select=borrower order=descending/> question

2003-06-17 12:48:06
Is this what you are referring to?
There is an html drop down list with vbscript which allows columns 
in the table to be selected, and then a dropdown with ascending or 
descending. How can these values be passed to these
variables?
<xsl:sort order="{$order}" select="*[name()=$sortColumn]"/>

tia,
dk

dynamically set the sort order
 
 Dimitre Novatchev 

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>

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]"/>
 


Original Message:
-----------------
From: Dimitre Novatchev dnovatchev(_at_)yahoo(_dot_)com
Date: Tue, 17 Jun 2003 20:06:20 +0200
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: <xsl:sort select="borrower" order="descending"/> question


http://dpawson.co.uk/xsl/sect2/N6461.html#d6859e950


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


<dmitrik(_at_)mindspring(_dot_)com> wrote in message
news:293580-220036217135613598(_at_)M2W088(_dot_)mail2web(_dot_)com(_dot_)(_dot_)(_dot_)

is there a way to pass a variable into the select
 <xsl:sort select="borrower" order="descending"/>

so that different values can be sorted in the xml?

 <xsl:for-each select="trades/trade">
       <xsl:sort select="borrower" order="descending"/>

tia,
dk

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>