[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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/
|
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
|