Try this stylesheet:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="node()|*[not(self::br) or not(self::b)]">
<xsl:copy><xsl:apply-templates /></xsl:copy>
</xsl:template>
<xsl:template match="node()|*[self::br or self::b]">
<xsl:value-of select="." />
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Fabrice Estiivenart <fe(_at_)cetic(_dot_)be>
Sent: Thu, 22 Jan 2004 13:37:09 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: RE: [xsl] remove <b> and <br>+merge nodes
that's it,
the main difficulty is to merge resulting text nodes into an unique one :
for example :
<p>my <b>tailor</b> is <br/> rich</p>
should become :
<p>
#text : my tailor is rich
<p>
and NOT :
<p>
#text : my
#text : tailor
#text : is
#text : rich
<p>
Fabrice
At 07:15 22/01/2004 -0500, you wrote:
Are you saying that you want to copy all elements except <b> and <br> and
copy the contents of <b>?
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Fabrice Estiivenart <fe(_at_)cetic(_dot_)be>
Sent: Thu, 22 Jan 2004 09:52:09 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] remove <b> and <br>+merge nodes
hi, thanks for your suggestion but i would like a more generic solution
that should work not uniquely on <p> elements...
At 12:35 21/01/2004 -0500, you wrote:
If you want to get rid of all the child elements of the <p> element and
retain their content, you can use this template. If you have some
elements that you want to retain and eliminate only the <b> and <br>
elements, we'll have to figure out something else.
<xsl:template match="p">
<xsl:value-of select="." />
</xsl:template>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Fabrice Estiivenart <fe(_at_)cetic(_dot_)be>
Sent: Wed, 21 Jan 2004 17:21:22 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] remove <b> and <br>+merge nodes
hi,
how can i remove <br> and <b> tags from an html document so that resulting
text nodes are merged into an unique one ?
for example :
<p>my <b>tailor</b> is <br> rich</p>
would become :
<p>my tailor is rich</p>
thanks for your good support,
Fabrice
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list