Subject: RE: Problems grouping adjacent siblings
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 30 Jun 2005 18:01:27 +0100
|
> I would like to group adjacent siblings which share the same
> local-name
> into a container element.
>
> I thought that this would be the classical use-case for an
> <xsl:for-each-group> with @group-adjacent, but I am getting the
> strangest results...
I can't tell what you are doing wrong without seeing your code.
With ax as the context node, you can do
<xsl:for-each-group select="*" group-adjacent="local-name()">
<xsl:choose>
<xsl:when test="current-grouping-key()='ex'">
<remark><xsl:copy-of select="current-group()"/></remark>
</
<xsl:otherwise>
<xsl:copy-of select="current-group()"/>
</
</
</
Michael Kay
http://www.saxonica.com/
|