[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Wanted: All unique namespaces in a document
> <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
|
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
|