[xsl] Re: sorting before transforming

Subject: [xsl] Re: sorting before transforming
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 20 Jul 2001 22:09:03 -0700 (PDT)
Dan Miner wrote:


> What I'd like to do is sort a list of nodes and then transform
> this sorted node list.  <xsl:sort> appears to only work on the
> resulting output and can not be applied to the input document.
> Is it possible to sort nodes in the input?  If not, is there a way
> to "chain" stylesheets?  [ XML1 -> XSL1 -> XML2 -> XSL2 -> XML3, etc]

Hi Dan,

It is always possible to capture the result of sorting within a xsl:variable and
(after converting this RTF to a regular node-set using the xxx:node-set() extension
function) then to apply templates on the contents of this xsl:variable.


<xsl:variable name="vSorted">
  <xsl:for-each select="$employees">
    <xsl:sort select="@name"/>

    <xsl:copy-of select="."/>

<xsl:apply-templates select="msxsl:node-set($vSorted)/*"/>

Also have a look at the recent thread about multiple passes and the generic template
for multiple pass processing:



Hope this helped.

Dimitre Novatchev.

Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger

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

Current Thread