[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Xpath 1.0 Question : Excluding Attributes?

Subject: Re: Xpath 1.0 Question : Excluding Attributes?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 29 Mar 2007 22:39:11 +0200
Re:  Xpath 1.0 Question : Excluding Attributes?
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
                     namespace-uri()=document('')/*/namespace::ns)]

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
                     count(.|../@ns:exclude-me)=1)]

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.

Indeed.


-- Abel Braaksma

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.