I tried the following XSLT 2.0 stylesheet, using xsl:for-each-group instruction, which worked well with the IBM XSLT engine.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="books">
<books>
<xsl:for-each-group select="book" group-by="author">
<author name="{current-grouping-key()}">
<xsl:for-each select="current-group()">
<book>
<xsl:copy-of select="name" />
<xsl:copy-of select="publisher" />
</book>
</xsl:for-each>
</author>
</xsl:for-each-group>
</books>
</xsl:template>
</xsl:stylesheet>
1 comment:
I missed this post. Glad to see it worked for you. Any feedback you have on later betas would be great. We've done three more betas since you wrote this.
http://webspherecommunity.blogspot.com/2009/07/xml-feature-pack-xpath-20xslt-20xquery.html
Post a Comment