Re: [xsl] regrouping split elements

Subject: Re: [xsl] regrouping split elements
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 21 Dec 2009 18:24:09 +0100
James Cummings wrote:

But to get this first step done, I've started out a number of
different ways before hitting stumbling blocks with
previous/following-sibling.  Is the right approach (in XSLT2) instead
to do something like xsl:for-each-group on the value of hi/@rend
inside each 'p'?

To fix the output you have I think you could use


<xsl:strip-space elements="p"/>

<xsl:template match="p">
<xsl:for-each-group select="node()" group-adjacent="boolean(self::hi)">
<xsl:when test="current-grouping-key()">
<xsl:for-each-group select="current-group()" group-adjacent="@rend">
<hi rend="{current-grouping-key()}">
<xsl:copy-of select="current-group()/node()"/>
<xsl:copy-of select="current-group()"/>


but you might rather not produce the wrong output at all and instead fix the stylesheet that produces the wrong output.

	Martin Honnen

Current Thread