[Home] [By Thread] [By Date] [Recent Entries]
In getting to the solution below I found that ". = ../namespace::*[name()]" as "is-namespace()" test is even simpler than Michael's "count(. | ../@*) != count(../@*)". It might be simpler, but it's wrong. Firstly, the expression attribute::*[name()] is rather pointless: it selects all attribute that have a name, and all of them do. While namespace::*[name()] selects all namespaces except the default namespace, so your test will fail for that one. Secondly, it's quite possible to have an attribute and a namespace with the same string-value, for example <xs:schema xmlns:a="http://my.namespace/" targetNamespace="http://my.namespace/"> and in this case your test for a namespace and your test for an attribute will both return true. Michael Kay Saxonica
|

Cart



