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

Re: [xsl] Remove element that all its descendants have no text nodes


Subject: Re: [xsl] Remove element that all its descendants have no text nodes
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 11 Feb 2010 13:28:03 +0100

Israel Viente wrote:

I didn't understand why we need the second rule too.

<xsl:template match="span[not(*) and not(normalize-space(.))]">
</xsl:template>

If you have time to explain a bit how this combination works I'll be very happy.

In the sample
<p dir="rtl"><span id="textStyle10"></span><sup>1</sup></p>
you want to remove the empty 'span' element but keep the 'p' and its 'sup' child. The template above ensures that the empty 'span' is removed.


--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/


Current Thread