This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: sorting
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Sat, 15 Jun 2002 01:23:05 +0200
- Subject: Re: [xsl] Re: sorting
- References: <009801c213bf$2200e340$af05020a@optionable.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
OBD wrote:
That works. Thanks.
In case there is no sort column, will setting the variable $chosen to some
value like 0
disable the sort? This is desired so I don't have to use <xsl:if> to special
case the
sorting (there is a related thread on this topic but I want to confirm for
this example).
0 is ok. column[0] doesn't exist, so there is nothing to sort for and
you should get the columns unsorted.
Also, I tried using an attribute directly in the predicate instead of a
variable and it
didn't work. Is this supposed to work? Example:
<xsl:sort select="column[number(@sort-column)]"/>
It's absolutely correct XPATH. But it will not do what you want as you
already have seen. Written in this way @sort-column refers to the
column, i.e. the @sort-column's value of the column to sort for. And
column is relative to the expression in the <xsl:for-each select="...">.
I think your only way is to store the @sort-column's value in a variable.
Is this a valid predicate? It is still better to use a variable, I believe,
because then
I could use <xsl:if> to set it to 0 if there was no sort-column attribute
and get the
benefits I described above, assuming it works that way.
Thanks,
Stuart Zakon
Regards,
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list