xsl-list
[Top] [All Lists]

Sibling sort after grouping

2005-10-27 08:14:28
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.


--~------------------------------------------------------------------
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>
  • Sibling sort after grouping, C. Zarate <=