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

RE: Attributes with default namespaces? XSLT Rec ques

Subject: RE: Attributes with default namespaces? XSLT Rec question..
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 13 Nov 2008 17:19:33 -0000
RE:  Attributes with default namespaces? XSLT Rec  ques
> A question about the XSLT recommendation..
> 
> If you add the following to your XSLT stylesheet:
>         <test xmlns="http://test">
>                 <xsl:attribute name="test"/>
>         </test>
> 
> What namespace should that attribute receive? Should the result be:
>         <test xmlns="http://test" test=""/>

Yes.
> 
> The XSLT 2.0 recommendation states:
>         "If the namespace attribute is not present, then the 
> lexical Qname is expanded into an expanded-QName using the 
> namespace declarations in effect for the xsl:attribute element, not 
> including any default namespace declaration."

That means: you take the prefix and look it up in the set of in-scope
namespace declarations. If there is no prefix, the attribute ends up in no
namespace.

Perhaps it doesn't say this in pedantic detail. However, the process of
expanding a lexical QName is fairly well understood: when there is no
prefix, you either use the default namespace, or you end up with a name that
is in no namespace; this text makes it clear that you don't use the default
namespace, therefore the only option left is to end up in no namespace.

Michael Kay
http://www.saxonica.com/

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.