[thelist] Another XSL question

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Wed Mar 12 10:37:24 CST 2003


Here's another question I can't seem to find the answer to on Google...

Given the following barebones stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                       xmlns:foo="foo/bar"
                       exclude-result-prefixes="xsl foo"
                       version="1.0">
</xsl:stylesheet>

And assuming I have another stylesheet I want to apply to the above
stylesheet skeleton, how can I access the "xmlns:*" attributes?

I've tried tons of ways, including directly accessing the values:

	<xsl:value-of select="/xsl:stylesheet/@xmlns:foo"/>
	<xsl:value-of select="/xsl:stylesheet/@foo"/>

Using namespace-uri:

	<xsl:value-of select="namespace-uri(/xsl:stylesheet/@xmlns:foo)"/>
	<xsl:value-of select="namespace-uri(/xsl:stylesheet/@foo)"/>

And using more convoluted means:

	<xsl:for-each
select="/xsl:stylesheet/attribute::*[contains(name(),'xmlns')]"/>

But none of these work.

When I do this:

	<xsl:for-each select="/xsl:stylesheet/@*">
		<xsl:value-of select="name()"/> <!-- pretend there's a line
break of some sort here for now -->
	</xsl:for-each>

All I get is this output:

	exclude-result-prefixes
	version

Is "xmlns" a "protected" attribute/namespace, so there is no way to access
it?

Thanks in advance,
-dave


More information about the thelist mailing list