Subject: Sibling sort after grouping
From: "C. Zarate" <lists@xxxxxxxxxx>
Date: Thu, 27 Oct 2005 11:14:28 -0400 (EDT)
|
I have a body of content, structured as:
<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?
<xsl:key name="group-by-tag" select="content/item/tag" use="."/>
...
<xsl:for-each
select="content/node/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.
|