This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: multiple sorting
- To: "Iyer, Srinivasan (MLIP - PCC)" <ISrinivasan at NA2 dot US dot ML dot com>
- Subject: Re: multiple sorting
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 16 Aug 2000 23:46:36 +0100
- Cc: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Reply-To: xsl-list at mulberrytech dot com
Iyer,
I think that the problem is that with the line:
sortField.setAttribute "select","'"+ field +"'"
you are setting the xsl:sort to look like:
<xsl:sort select="'NAME'" />
When the select expression is evaluated for each of the nodes that's being
sorted, it always comes up with the same value, the string 'NAME'. If you
instead want it to sort on the value of the *child node* called NAME, then
you want either:
<xsl:sort select="*[name() = 'NAME']" />
(which is equivalent to changing the value of the parameter and leaving the
sort expression as it is) or simply:
<xsl:sort select="NAME" />
To create the latter, you just need to take out the extra quotes that are
making the XSLT processor interpret it as a string rather than an element
name:
sortField.setAttribute "select",field
I haven't tested this, but I think it might work.
I hope this helps,
Jeni
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list