[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to output the unused namespaces in the XML do
It isn't possible to know whether a namespace is unused. I think what
you mean is "not used in any element or attribute name".
The simple answer to that in XPath 2.0 is distinct-values(//namespace::*[not(. = //*/namespace-uri() or . = //@*/namespace-uri())]). However, your code is testing something different. Given this source document <?xml version="1.0"?> <N1:NumberList> <Number>23</Number> <Number>41</Number> <Number xmlns:N3="http://www.example3.org">70</Number> <N3:Number xmlns:N3="http://www.example3.org">103</Number> <Number>99</Number> <Number>6</Number> </N1:NumberList> You will report http://www.example3.org as unused because there is a declaration of this namespace that is not used in any ancestor or descendant of the element where it is declared; my code considers it as used because there is an element where it is used. As usual, it all comes down to careful specification of your problem. Michael Kay Saxonica Hi Folks,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|