Subject: Re: [xsl] Split element with mixed content From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Thu, 02 Aug 2007 18:49:50 +0200 |
What is the best method for splitting an element that has mixed content?
<root> <p>The quick <b>brown</b> fox jumped over the lazy dog.</p> </root>
In the above example I want to split on the word 'over'.
<p>this <b> quick </b> brown fox <span> <style> jumps <b> very far over the beautiful </b> and stunningly </style> resilient, </span> utterly lazy <q> dog </q> </p>
<xsl:template match="p"> <xsl:apply-templates select="node() | @*" mode="#current" /> </xsl:template>
<xsl:template match="text()[contains(., 'over')]"> <xsl:apply-templates select="ancestor::p" mode="split-before" > <xsl:with-param name="split-by" select="current()" tunnel="yes" /> </xsl:apply-templates> <xsl:apply-templates select="ancestor::p" mode="split-after" > <xsl:with-param name="split-by" select="current()" tunnel="yes" /> </xsl:apply-templates> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Split element with mixed , Kevin Bird | Thread | Re: [xsl] Split element with mixed , Abel Braaksma |
RE: [xsl] Split element with mixed , Kevin Bird | Date | Re: [xsl] Split element with mixed , Abel Braaksma |
Month |