RE: [xsl] Shallow copy and base URI

Subject: RE: [xsl] Shallow copy and base URI
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 29 Jan 2006 00:07:49 -0000
>   I looked fo the validity of this in the XSLT 2.0
> recommendation.
>
>   I didn't find definition of the base URI in XSLT 2.0 other
> than:
>
>     '5.4.1: The concept of the base URI of a node is defined
>     in Section 5.2 base-uri Accessor [Data Model]
>
>   The referenced section in XDM stands:
>
>     '5.2: The dm:base-uri accessor returns the base URI of a
>     node as a sequence containing zero or one URI
>     reference. For more information about base URIs, see
>     [XML Base].
>
>   Finally, XML Base defines in '4.2 that if an element has
> an xml:base attribute, its value is the base URI of the
> element.

Yes, fine so far.

>
>   XSLT 2.0 itself often speaks in term of @xml:base instead
> of base URI.

I think it's careful to distinguish the two. An element has a base URI
whether or not there is an xml:base attribute.
>
>   So what I understand is that the base URI of the literal
> element in the stylesheet is the one of the stylesheet (as
> for example the XML parser sees it).

When a literal result element is processed, the newly constructed element
has the same base URI as the literal result element in the stylesheet. This
will normally be the base URI of the stylesheet document - but if the
literal result element has an @xml:base attribute, that determines the base
URI just as it would in any other document.


> When the XSLT
> processor constructs this element and add the result of its
> sequence constructor, if it obtains an xml:base attribute,
> its base URI changes to this new one.
>
>   Right?

Yes.
>
>   So implemtors should be carefull to catch this special
> case.

It's not really a special case. It's just one of the processing rules like
any other.

> I'm surprised XSLT 2.0 points out 2 special cases for
> @name ('xmlns' and 'xml:id'), but doesn't speak about the
> case of 'xml:base'.
>

I'm not sure what you mean by this. xml:base is frequently mentioned in the
spec.

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

Current Thread