Subject: [xsl] sorting parameter ? From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx> Date: Fri, 5 Mar 2004 15:46:51 +0100 |
Hello ! I would like to sort xml datas to display them in function of the user's sort choice. I send the sorting parameter (chosen by the user in a HTML form) to the xsl stylesheet with the function addParameter from my xslt processor. As I cannot do : <xsl:sort select="$SortParam" case-order="lower-first"/> I must evaluate the parameter as an XPath expression, which i have done using the *evaluate* function of the *dyn* namespace : <xsl:sort select="dyn:evaluate(.,$SortParam)" case-order="lower-first"/> This is my xsl declaration : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dyn="http://exslt.org/dynamic" xmlns:msxsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="dyn msxsl"> and the dyn function is defined as follow : <msxsl:script implements-prefix="dyn" language="jscript"> function evaluate(context, expression) { return context.nextNode().selectNodes(expression); } </msxsl:script> It work fine but I'm just wondering if there's not another way of doing it using standard xsl. I have seen things with <xsl:key> but i don't know if it is appropiate here and actually i don't really understand what's this element aims at... Do you have suggestions ? In advance thanks, Matthieu. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Generating HTML table, Andreas Lindahl | Thread | Re: [xsl] sorting parameter ?, David Carlisle |
Re: [xsl] Accessing specific repeti, Mark Williams | Date | RE: [xsl] Generating HTML table, cknell |
Month |