Subject: Wanted: All unique namespaces in a document
From: "Ingo Macherius" <macherius@xxxxxxxxxxxxxxxx>
Date: Wed, 5 Apr 2000 04:12:42 +0200
|
Hi,
I'm trying to write an XSLT sheet extracting all unique namespaces used in a
document. My processors of choice are Xalan 1.0.0 and SAXON, as current XT
does not support the namespace:: axis. The results are, err, quite random.
And I haven't tried Oracle yet :)
(1) First attempt:
<xsl:for-each select="//namespace::*">
<xsl:value-of select="."/>
</xsl:for-each>
In Xerces, this yields a namespace-uri for each element with an xmlns:foo
attribute (including doublets). In SAXON it outputs many, many
namespace-uri. I guess it may return all namespaces visible from each
element.
(2) Second attempt:
<xsl:for-each select="
//*
[not( namespace-uri(.) = namespace-uri(preceding::.))]
">
<xsl:value-of select="namespace-uri(.)"/>
</xsl:for-each>
Fails in SAXON (illegal construct preceding::.). In Xerces it does not fail,
and returns the namespace URI string for each element in the document.
Anyone with a clue for a solution that (at least in theory) works ?
Regards,
++im
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|