Thread: Grouping xmls
View Single Post
 
Old July 28th, 2008, 06:00 PM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

5 hours before your post someone else asked about grouping: check the answer to that post.

If you are producing multiple output documents you will want to use XSLT 2.0 with its xsl:result-document instruction.

<xsl:for-each-group select="row" group-by="id">
  <xsl:result-document href="{current-grouping-key()}.xml">
    <xsl:copy-of select="current-group()"/>
  </xsl:result-document>
</xsl:for-each-group>

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference