RE: [xsl] namespace::* or what?

Subject: RE: [xsl] namespace::* or what?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 16 Feb 2001 18:33:12 -0000
> How do I find out -- in the most efficient way -- what namespaces
> have been mapped using xmlns? I want to known in the document node
> so that I can apply some text in the beginning of the result document.

You can do select="//namespace::*" but the list will contain many
duplicates. These are not easy to eliminate using the normal techniques
because namespace nodes are not on the preceding axis and cannot be keyed
(because they cannot be matched in a pattern).

With Saxon you can do saxon:distinct(//namespace::*)

If you are only interested in namespaces that are actually used in the name
of an element, you can do Muenchian grouping on the full set of element
nodes (//*) with a grouping key of namespace-uri(); you can add those used
in attribute names by using (//*|//@*).

Mike Kay

 XSL-List info and archive:

Current Thread