RE: Using the not() function

Subject: RE: Using the not() function
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Tue, 18 Jan 2000 19:38:49 -0700
> So am I missing something here?  I get errors in processing 
> when I have:
> <xsl:template match="my:root">
>   <xsl:apply-templates select="not(self::my:element)" />
> </xsl:template>
> on the following document:
> <my:root xmlns:my="";>
>   <my:element />
>   <my:otherElement />
> </my:root>

I assume you declared xmlns:my=""; in the stylesheet, since
you're selecting 'element' elements associated with the namespace that 'my'
is a prefix for.

"not(self::my:element)" by itself is incorrect because you haven't selected
nodes along an axis first. Many nodes on many axes (for example, my:root)
could be "not elements named 'element' in the '' namespace".

Try "node()[not(self::my:element)]" or "*[not(self::my:element)]" which will
first select nodes or elements along the child axis, then will narrow down
that set to only those that meet the additional criteria.

 XSL-List info and archive:

Current Thread