xsl-list
[Top] [All Lists]

RE: [xsl] Attributes with default namespaces? XSLT Rec question..

2008-11-13 12:20:01

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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--