Re: [xsl] Xpath 1.0 Question : Excluding Attributes?

Subject: Re: [xsl] Xpath 1.0 Question : Excluding Attributes?
From: Abel Braaksma <>
Date: Thu, 29 Mar 2007 22:39:11 +0200
G. Ken Holman wrote:
At 2007-03-29 10:49 +0200, Abel Braaksma wrote:

and this with QNames:

//tier1/tier2/@*[not(name() = 'ns:exclude-me')]

I think someone should make the observation that the above test is not namespace-safe.

I should've known, thanks for pointing that out ;)

If you wanted to base the test on the stylesheet use of the "ns" prefix, one could do:

//tier1/tier2/@*[not(local-name()='exclude-me' and

This, though very nice (never thought of that!), does require the XSLT 1.0 processor to support the namespace axis. Not all do that, for instance, TransformIIX does not, which makes this less-than-ideal for browser-based transformations (but I don't know what processor the OP uses).

I suppose you could even use the principle of union in:

//tier1/tier2/@*[not(../@ns:exclude-me and

Wow, I'm impressed! It took me a minute or so to understand count(.|../@ns:exclude)=1, but it really is pretty. I often have trouble with booleans and XSLT, using the union like this would've never occurred to me.

I favor this one ;)

Any one of those three above would allow the namespace prefix used in the input instance for the stylesheet "ns" namespace.

I do think your proffered solution for QNames is not appropriate.


-- Abel Braaksma

Current Thread