xsl-list
[Top] [All Lists]

Re: Fw: Is it possible to sort the way I want

2004-04-11 22:59:36
I was afraid of that.  I think it will be easier to
adjust my XML input a bit since I can control that
some what.

Thanks for the info,

IL


"Michael Kay" <mhk(_at_)mhk(_dot_)me(_dot_)uk> wrote on 2004-04-09
01:51:28:

If there's a limit on the nesting depth you can
declare a series of sort keys:

<xsl:sort select="(ancestor::*/@name)[1]"/> 
<xsl:sort select="(ancestor::*/@name)[2]"/>
<xsl:sort select="(ancestor::*/@name)[3]"/>
<xsl:sort select="(ancestor::*/@name)[4]"/>
<xsl:sort select="(ancestor::*/@name)[5]"/>

Otherwise you need a multi-phase approach: one
phase to compute the sort keys, the second 
phase to do the sort.

It's easy in XSLT 2.0, just do

<xsl:sort select="string-join(ancestor::*/@name,
'.')"/>

Michael Kay


__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html


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