[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:element in XSLT 1.0
> 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
|
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
|