|
Subject: Re: [xsl] How to sort a $variable and store that into another $variable ? From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Wed, 10 Dec 2008 19:30:55 +0100 |
I'm trying to sort a <xsl:variable> containing 22 nodes and store this sorted list into another xsl:variable.
Is this possible ?
Is there a way to do this ?
Ps: this is xsl 1.0.
<root> <foo>10</foo> <foo>2</foo> <foo>1</foo> <foo>4</foo> </root>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="v1" select="root/foo"/>
<xsl:variable name="v2">
<xsl:for-each select="$v1">
<xsl:sort select="." data-type="number"/>
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:variable>
<result>
<xsl:copy-of select="$v2"/>
</result>
</xsl:template><result> <foo>1</foo> <foo>2</foo> <foo>4</foo> <foo>10</foo> </result>
Martin Honnen http://JavaScript.FAQTs.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] How to sort a $variable and s, Jean-Philippe Martin | Thread | Re: [xsl] How to sort a $variable a, Jean-Philippe Martin |
| [xsl] How to sort a $variable and s, Jean-Philippe Martin | Date | Re: [xsl] How to sort a $variable a, Jean-Philippe Martin |
| Month |