Subject: Re: [xsl] Question regarding namespaces From: Chris von See <chris@xxxxxxxxxxxxx> Date: Mon, 7 Apr 2008 22:18:50 -0700 |
Cheers Chris
I have a stylesheet which I use to normalize various versions of a DTD. Some old XML documents created against this DTD do not include a default namespace declaration on the root element but the newer ones do, and I think the way I have to handle this is to have two templates in my stylesheet, one of which selects root elements without a namespace and one which does:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mynamespace="namespaceURI" version="2.0">
<xsl:template match="rootElement">
<!-- do stuff when no namespace declaration present: older documents -->
</xsl:template>
<xsl:template match="mynamespace:rootElement">
<!-- do stuff when there is a namespace declaration present: newer documents -->
</xsl:template>
...
</xsl:stylesheet>
Documents which have a namespace declaration specify it as <rootElement xmlns="namespaceURI">.
I'm noticing that the stylesheet works fine when run under a debugger such as Oxygen. However, when I compile this stylesheet under Saxon-B 9-0-0-4j and run it as the first filter of a JAXP filter chain, the template with the namespace prefix gets invoked regardless of whether the XML document specifies a namespace on its root element or not. I put in some <xsl:message> statements to dump the in-scope namespaces, and the only one I see is the XML namespace - no reference to "namespaceURI". Any thoughts on what's going on here, or where my logic is faulty?
Thanks Chris
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Question regarding namespaces, Chris von See | Thread | RE: [xsl] Question regarding namesp, Michael Kay |
[xsl] Question regarding namespaces, Chris von See | Date | RE: [xsl] Question regarding namesp, Michael Kay |
Month |