xsl-list
[Top] [All Lists]

Re: [xsl] Filter out elements that have one specific sub-element and nothing else

2007-02-21 06:28:25

On Feb 21, 2007, at 5:05 AM, stephan(_at_)wissel(_dot_)net wrote:

I need to filter out this element:
    <listitem>
        <formatinfo color="blue" />
    </listitem>

The rule: if listitem contains only formatinfo and no other element or
text then remove it.

Hi Stephan, how about

<xsl:template match="listitem [formatinfo [ not (sibling::* | sibling::text()[normalize-space()]) ]]" />

cheers,
—ml—


--~------------------------------------------------------------------
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>
--~--