xsl-list
[Top] [All Lists]

[xsl] How to sort a $variable and store that into another $variable ?

2008-12-10 13:20:23
Hi,
I'm trying to sort a <xsl:variable> containing 22 nodes and store this
sorted list into another xsl:variable.

Is this possible ?

Here's the best I could do :

<xsl:variable name="sortedList">
    <xsl:call-template name="sortThis">
        <xsl:with-param name="unsortedList" select="$unsortedList"/>
    </xsl:call-template>
</xsl:variable>

  <xsl:template name="sortThis">
    <xsl:param name="unsortedList"/>

    <xsl:for-each select="$unsortedList">
      <xsl:sort select="."/>
      <xsl:copy-of select="."/>
    </xsl:for-each>
  </xsl:template>

I have also tried it this way but with the same result :

<xsl:variable name="sortedList">
    <xsl:apply-templates mode="sort" select="$unsortedList">
        <xsl:sort select="."/>
    </xsl:apply-templates>
</xsl:variable>

  <xsl:template match="node()" mode="sort">
     <xsl:copy-of select="@*"/>
  </xsl:template>


What I get is a single node containing all the values sorted
concatenated in a single string.

Is there a way to do this ?

Ps: this is xsl 1.0.

Thank you very much.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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