Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2005, 06:00 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sibling sort after grouping

I have a body of content, structured as:

Code:
<content>
 <item>
  <tag>...</tag>
  <tag>...</tag>
  <tag>...</tag>
  <date>...</date>
  ...
 </item>
 ...
</content>
My goal is to generate a list of all tags, sortable by date. "Date" in this context would mean the most recent "date" child of any "item" node that contains a given "tag" child. Dates are ISO 8601 formatted.

Currently, this list of tags is sorted alphabetically. How can I modify the below XSL (1.0) to achieve a "last-modified" sort, as outlined above?

Code:
<xsl:key name="group-by-tag" select="content/item/tag" use="."/>
...
<xsl:for-each
select="content/item/tag[generate-id()=generate-id(key('group-by-tag',.)[1])]">
 <xsl:sort select="." order="ascending"/>
 <xsl:value-of select="."/>
</xsl:for-each>
Thank you for any assistance you can provide.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM
does grouping sort too? wyatt.smith XSLT 4 March 17th, 2005 10:41 AM
preceding-sibling after sort rushman XSLT 3 January 18th, 2005 11:08 AM
MDI Sibling calling Sibling... Nick.Net VB.NET 2002/2003 Basics 1 December 8th, 2003 09:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.