santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Thomson" <martin.thom...@nortel.com>
Subject XPath transform: attribute selection
Date Thu, 19 May 2005 22:15:10 GMT
I'd be interested in any different takes on my method for selecting
attributes:

Unfortunately "(//@* | //namespace::*)" evaluates to true for all nodes in a
document (as long as there is at least one attribute anywhere.

The following happily selects all attributes and namespace declarations in a
document - is there a better method?

<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"
   xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
  <dsig:XPath>
  (count(self::node() | parent::*/attribute::* | parent::*/namespace::*)
    < (count(self::node()) + count(parent::*/attribute::*) +
count(parent::*/namespace::*)))
  </dsig:XPath>
</dsig:Transform>

The above method also works for text().

Martin 

Mime
View raw message