xsl-list
[Top] [All Lists]

Re: [xsl] dynamic sort using attributes

2006-12-05 02:56:22
On 12/5/06, L P <listaction(_at_)gmail(_dot_)com> wrote:
Folks,

 I've tried searching the lists, but could not find a definitive /
clear answer to this question, so here it goes:

 How can I sort an xml list based on attributes dynamically ( I do not
know which attribute before hand)?

  For instance, I have the following xml:
  <reminders>
    <reminder category="Test" nm="XXX" description="foobar"/>
  <reminder category="Test12" nm="yyy" description="barfoo"/>
   </reminders>


I would like to sort the xml file based on the attribute which will be
supplied as a parameter.

So, assume that i have an xsl:param with the value of the attribute
that I would like the results to be sorted by.
I know that this can be accomplished if I change the xml structure and
make the attributes child elements, but that is not an option for me.

Is there any work around that can accomplish this without changing the
XSL file (before complie time)?

The usual way of dynamic sorting should be fine:

<xsl:sort select="@*[name() = $sortAtt]"/>

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>