[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:element in XSLT 1.0

Subject: Re: xsl:element in XSLT 1.0
From: david_n_bertoni@xxxxxxxxxx
Date: Wed, 22 Jun 2005 14:53:50 -0700
xslt xsl element namespace
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.