Subject: Re: [xsl] xsl:element in XSLT 1.0 From: david_n_bertoni@xxxxxxxxxx Date: Wed, 22 Jun 2005 14:53:50 -0700 |
> This is sort of a fuzzy area in the spec, so any help would be > appreciated. I'm not sure it's so fuzzy. Can you explain why you think it is? > When an xsl:element contains namespace declarations outside of the > 'namespace' AVT, when should those namespace declarations be inserted > into the result tree? > > Here is an example of my problem: > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:template match="*"> > <out> > <xsl:element name="foo" xmlns:a="bar"> > <child/> > </xsl:element> > </out> > </xsl:template> > </xsl:stylesheet> > > Xalan produces this: > > <out><foo xmlns:a="bar"><child/></foo></out> That output is not correct. Xalan-C 1.9 produces the following: <?xml version="1.0" encoding="UTF-8"?><out><foo><child xmlns:a="bar"/></foo></out> There was a bug in older versions of Xalan-C and Xalan-J where namespace declarations on xsl:element would produce corresponding namespace declarations in the result tree, but that was a bug that has since been corrected. I believe Saxon's output in this case is correct. > However, if I modify the stylesheet slightly... ... > Xalan and Saxon both produces this: > > <out><a:foo xmlns:a="bar"><child/></a:foo></out> > > Clearly the 'bar' namespace belongs on the 'a:foo' result element., > but this begs the question: How can this namespace be in scope for > 'foo' depending on whether it is used or not? Well that's a very different case, because the namespace declaration is now required on the foo element. The real issue is whether a namespace declaration in a stylesheet generates a namespace node in the result tree, and in the case of xsl:element, it does not. Dave
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:element in XSLT 1.0, Jack Matheson | Thread | Re: [xsl] xsl:element in XSLT 1.0, Jack Matheson |
Re: [xsl] Linking to a 6 level tag , Kahlil Johnson | Date | RE: [xsl] Schema aware transformati, Michael Kay |
Month |