xsl-list
[Top] [All Lists]

Re: [xsl] Un-nesting elements in XSLT 2.0

2006-11-10 17:08:23

It's a grouping question, you want to group things into groups of adjacent
nodes that are either block level nodes (which you process directly)
or inline nodes (which you put in a <p>

<xsl:template match="para">
<xsl:for-each-group select="node()" group-adjacent="self::img or self::table">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:apply-templates select="current-group()"/>
</xsl:when>
<xsl:otherwise>
<p>
<xsl:apply-templates select="current-group()"/>
</p>
</xsl:otherwis>
</xsl:choose>
</xsl:template>

David



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>