[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Wanted: All unique namespaces in a document

Subject: RE: Wanted: All unique namespaces in a document
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 5 Apr 2000 14:12:57 +0100
unique namespaces
> 		<xsl:for-each select="//namespace::*">
> 			<xsl:value-of select="."/>
> 		</xsl:for-each>
> 
> In SAXON it outputs many, many namespace-uri. I guess it may return all
namespaces > > visible from each element.
yes, the XPath tree model says that each element node has a namespace node
for each namespace that is in scope for that element, and the namespace
nodes are not shared between elements.

> <xsl:for-each select="//*[not( namespace-uri(.) =
namespace-uri(preceding::.))]">

Firsly, preceding::. is wrong because . is not a NodeTesT. Secondly, this
only considers namespace URIs that are referenced by element names in the
source document, it will not consider namespaces that are used only for
attributes, or that are unused.

It's difficult to do a uniqueness test because namespaces aren't on the
preceding axis. Sounds like a good case for saxon:distinct():

select="saxon:distinct(//namespace::*)"

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.