W3C home > Mailing lists > Public > www-xpath-comments@w3.org > October to December 2003

Re: [Q] Possible to select all attributes except some?

From: Steinar Bang <sb@dod.no>
Date: Sun, 23 Nov 2003 21:58:30 +0100
To: www-xpath-comments@w3.org
Message-ID: <87r7zyzts9.fsf@doohan.bang.priv.no>

>>>>> Jeni Tennison <jeni@jenitennison.com>:

> XSLT/XPath questions (as opposed to comments on the XSLT/XPath
> specifications) are best addressed to xsl-list@lists.mulberrytech.com.

Thanx for the info.  I'll ask there next time.

>> Is it possible to replace "@*" with an expression that would select
>> all attributes except the attribute named "background"[3][4]?

> In XPath 1.0, use:

>   @*[name() != 'background']

> (select every attribute whose name is not 'background').

> In XPath 2.0, use:

>   @* except @background

> (select every attribute except the background attribute).

The XPath 2.0 variant failed (using libxml2 2.6.2 and libxslt 1.0.33),
but the XPath 1.0 variant worked great.

The style sheet should strip src attributes as well, so the actual
XPath expression I ended up with, was
	@*[name() != 'background' and name() != 'src'

Thanx!  And thanx to Michael Kay as well!

- Steinar
Received on Sunday, 23 November 2003 16:22:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:02:15 UTC