Title: XPath transform: attribute selection

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

Reply via email to