From: Fabrice DESRE - FT.BD/FTRD/DMI/GRI (fabrice.desre@francetelecom.com)
Date: 07/11/2001 - 08:52
Anthony Muller wrote:
> <xsl:param name="sort"/>
>
> <xsl:for-each select="rt[@key >= 1500 and @key <= 1600]">
>
> <xsl:choose>
> <xsl:when test="$sort = date">
> <xsl:sort select="key" data-type="number"
> order="ascending"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:sort select="key" data-type="number"
> order="descending"/>
> </xsl:otherwise>
> </xsl:choose>
>
> ... bla bla ....
>
> </xsl:for-each>
Hello Antony,
I think you made two mistakes :
1) You probably mean <xsl:when test="$sort = 'date'">. In your
expression, date
is a node, not a string value.
2) Accordind to [1], <xsl:sort/> has to be a child of <xsl:for-each/>.
In your
sample it is a child of <xsl:when/> and <xsl:otherwise/>. My
interpretation of
the XSLT recommendation is that the XSLT processor is correct if it
ignores your
<xsl:sort/> elements.
So you should try this :
<xsl:param name="sort"/>
<xsl:choose>
<xsl:when test="$sort='date'>
<xsl:for-each select="rt[@key >= 1500 and @key <= 1600]">
<xsl:sort select="key" data-type="number" order="ascending"/>
... bla bla...
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="rt[@key >= 1500 and @key <= 1600]">
<xsl:sort select="key" data-type="number" order="descending"/>
... bla bla...
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
Fabrice
[1] http://www.w3.org/TR/xslt#sorting
--
Fabrice Desré - France Telecom R&D/DMI/GRI
Tel: +(33) 2 96 05 31 43
Fax: +(33) 2 96 05 32 86
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|