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

[Q] Possible to select all attributes except some?

From: Steinar Bang <sb@dod.no>
Date: Sat, 22 Nov 2003 11:48:00 +0100
To: www-xpath-comments@w3.org
Message-ID: <871xs03cin.fsf@doohan.bang.priv.no>

Is it possible to write an XPath expression to select all attributes,
except some.

The context is that the new Web interface of the Gmane mail<->NNTP
gateway[1] will use an XSLT style sheet to transform HTML emails to
harmless HTML, by stripping everything in HTML that may be
exploited[2]. 

The style sheet use the following construct to copy elements that
should be preserved:

<xsl:template match="h1|h2|h3|h4|h5|h6|p|a|td">
  <xsl:element name="{name(.)}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

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

Thanx!


- Steinar

[1] <http://gmane.org/>
[2] <http://article.gmane.org/gmane.discuss/4353>
[3] <http://article.gmane.org/gmane.discuss/4525>
[4] <http://article.gmane.org/gmane.discuss/4526>
Received on Saturday, 22 November 2003 09:55:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:55 GMT