Re: [xsl] Troubleshooting a sort

Subject: Re: [xsl] Troubleshooting a sort
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 20 Feb 2004 00:53:14 GMT
<xsl:for-each select="//SAVEIdeas/SAVEIdea">
<xsl:sort select="*[name()=$param1]"/>

Usually, I'm sorting on a child of the root element (SAVE_ID,
date_submitted, etc.) These sorts are all working fine. But I also need
to sort on the *last* status element. Status is not a child of the root,
but a child of status_history. Is that the problem? Do I need to have
something conditional for the sort statement? I welcome any additional

It's not a problem, but you have to make your sort xpath select teh
required element and * won't select a grandchild ever in xpath.

<xsl:for-each select="/SAVEIdeas/SAVEIdea">
<xsl:sort select="(*|*/*)[name()=$param1][last()]"/>

(I didn't spot the requiremnt you had for last() in previous reply)


 XSL-List info and archive:

Current Thread