Re: multiple sorting

Subject: Re: multiple sorting
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 16 Aug 2000 23:46:36 +0100
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


Current Thread