[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Mixed content, separation

Subject: Re: [xsl] Mixed content, separation
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Feb 2012 09:48:40 +0100

Hi Dave,

You could use grouping with adjacent

<xsl:template match="p">
<xsl:for-each-group select="node()" group-adjacent="if(self::ul | self::dl) then(generate-id()) else('inline')">
<xsl:when test="current-grouping-key() = 'inline'">
<xsl:apply-templates select="current-group()"/>
<xsl:apply-templates select="current-group()"/>

    <xsl:template match="node()">
            <xsl:copy-of select="@*"></xsl:copy-of>
            <xsl:apply-templates select="node()"></xsl:apply-templates>

since you don't know what the inlines are, I hope you know what the block elements are
you can make the test for block better yourself I guess

At 09:37 29/02/2012, you wrote:
<p> text1 <i>italic</i>
text 2</p>
<p> text1 <i>italic</i>
text 2</p>

How can I produce

<p> text1 <i>italic</i></p>
<p>text 2 (any other inlines)</p>

I.e. isolate the block elements...

nasty side:
   I'm unsure of the list of inline elements!

any suggestions appreciated.


Current Thread