[Home] [By Thread] [By Date] [Recent Entries]
Fabien Tillier wrote:
Hi Andrew. Hum... should I say I can't have it work ? <xsl:for-each-group select="para/phrase" group-adjacent="@role"> <xsl:copy-of select="."/> </xsl:for-each-group> Try along these lines <xsl:template match="para"> <xsl:copy> <xsl:for-each-group select="*" group-adjacent="boolean(self::phrase[@role = 'rtf'])"> <xsl:choose> <xsl:when test="current-grouping-key()"> <phrase role="rtf"> <xsl:apply-templates select="current-group()/node()"/> </phrase> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:copy> </xsl:template> Might need an identity transformation template for all nodes you want to copy by the apply-templates in the otherwise branch. -- Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
|

Cart



