On 2012-08-31 17:04, Michael Kay wrote:
Untested solution:
<xsl:for-each-group select="Product" group-adjacent="@id">
should be group-by, of course
<xsl:for-each select="current-group()">
<xsl:sort select="number(rank)" order="descending"/>
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
The complete template might look like this:
<xsl:template match="Products">
<xsl:copy>
<xsl:copy-of select="@*, Manager" />
<xsl:for-each-group select="Product" group-by="@id">
<xsl:for-each select="current-group()">
<xsl:sort select="number(rank)" order="descending"/>
<xsl:if test="position() = 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
<xsl:copy-of select="* except (Manager union Product)" />
</xsl:copy>
</xsl:template>
--~------------------------------------------------------------------
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>
--~--