|
Subject: [xsl] How to split mixed content From: Jesper Tverskov <jesper@xxxxxxxxxxx> Date: Sun, 15 Feb 2009 12:46:03 +0100 |
I'm looking for a way to split mixed content. Something like the
tokenize() function but for mixed content. Let us say inside a "p"
element containing escaped markup, real XHTML like "span" elements and
"br" elements.
I want to use the "br" element as splitter.
I have come up with the following solution that seems to work.
<xsl:template match="p">
<lines>
<xsl:for-each-group select="node()" group-starting-with="br">
<xsl:if test="position() = 1">
<line><xsl:copy-of select="current-group()"/></line>
</xsl:if>
<xsl:if test="position() > 1">
<line><xsl:copy-of select="current-group() except ."/></line>
</xsl:if>
</xsl:for-each-group>
</lines>
</xsl:template>
Here is my question:
Is my solution the way to split mixed content or is there an easier or
a more elegant way?
Cheers,
Jesper Tverskov
http://www.xmlkurser.dk
http://www.xmlplease.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Wrapping content in a CDA, Ken Starks | Thread | Re: [xsl] How to split mixed conten, David Carlisle |
| Re: [xsl] Wrapping content in a CDA, Chad Chelius | Date | Re: [xsl] Wrapping content in a CDA, Martin Honnen |
| Month |