Subject: Re: XSL Sort and Xalan From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 03 Aug 2000 23:40:46 +0100 |
Bryce, >But, I would like the end-user to be able to sort this data in the HTML >page, without making another call to the database (which is generating the >XML) - and was hoping to accomplish this by creating a parameter that would >trigger the proper column to sort. > >So, I created the parameter and gave it a static value (I'll pass them >dynamically later) ><xsl:param name="item" select="'RECORD/LENGTH'"/> In your example, you've set the value of the parameter $item to the string 'RECORD/LENGTH'. Similarly, if the parameter is passed in by the XSLT processor, the value is going to be a string. The value of the 'select' attribute of xsl:sort is interpreted as an XPath, generating a node set whose value is used to give the value of the node on which it will be sorted. Using: <xsl:sort select="$item" /> has the same effect as: <xsl:sort select="'RECORD/LENGTH'" /> As a string, $item gives the same value ('RECORD/LENGTH') each time it is processed. As each OBJECT_TABLE is given the same value for the sort, they are sorted in the order that they appear in the source. Strings cannot be interpreted as node sets (this has been recently covered in another thread) unless you use extension functions such as saxon:node-set. What you *can* do (and the solution is blessedly straight-forward in your case) is construct an XPath that uses the value of $item to identify the value that should be used to sort the OBJECT_TABLEs: <xsl:sort select="RECORD/*[name() = $item]" /> In other words, sort the OBJECT_RECORDs on the value of the first child element of a RECORD element child of the OBJECT_RECORD, that has the same name as $item. I hope this helps, Jeni Dr Jeni Tennison Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: XSL Sort and Xalan, Bryce Wells | Thread | RE: XSL Sort and Xalan, Don Bruey |
Image in XSL?, Medina, Edward | Date | RE: node-set() function in MSXML?, Kay Michael |
Month |