xsl-list
[Top] [All Lists]

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

2010-02-11 09:48:15
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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>