xsl-list
[Top] [All Lists]

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

2008-11-13 12:18:05
Hi Ken,

I would rather say the notion of 'being in no namespace' slipped my attention. 
I found the relevant part in section 6.2:

        "A default namespace declaration applies to all unprefixed element
         names within its scope. Default namespace declarations do not apply
         directly to attribute names; the interpretation of unprefixed 
attributes
         is determined by the element on which they appear.

        ...The namespace name for an unprefixed attribute name always has no 
value...."

        (http://www.w3.org/TR/2006/REC-xml-names11-20060816/#defaulting)

Thanks for sharpening my attention..

Kind regards,
Geert




Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


From: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com]
Sent: donderdag 13 november 2008 17:59
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Attributes with default namespaces? XSLT
Rec question..

At 2008-11-13 17:50 +0100, Geert Josten wrote:
A question about the XSLT recommendation..

I think you'll find the answer in the Namespaces in XML
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?

Namespaces in XML states that attributes without prefixes are
in no namespace, not in the default namespace:

   http://www.w3.org/TR/2006/REC-xml-names11-20060816/#uniqAttrs

Should the result be:
        <test xmlns="http://test"; test=""/>

Yes ... because the element is in the default namespace and
the attribute is in no namespace.

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."

Makes sense since unprefixed attributes are in no namespace.

The xsl:attribute has no namespace attribute, and the lexical Qname
contains no prefix. But since de default namespace
declaration should
not be included in resolving/expanding the Qname, I would expect the
latter result should appear.

Not when you take into consideration that unprefixed
attributes are in no namespace.

 However, the latter is not valid according to:
        (http://www.w3.org/TR/REC-xml-names/#ns-decl, 2nd
paragraph or
so)

..nor does any of the common implementations give that
result, the all
return the first..

As they should.

Am I misinterpreting the XSLT recommendation?

No, you are unaware of the constraints of the namespaces
recommendation.

I hope this helps.

. . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--