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:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:strip-space elements="p"/>
<xsl:template match="p">
<xsl:copy>
<xsl:for-each-group select="node()"
group-adjacent="boolean(self::hi)">
<xsl:choose>
<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()"/>
</hi>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
but you might rather not produce the wrong output at all and instead fix
the stylesheet that produces the wrong output.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
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>
--~--