W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > September 2011

RE: document base uri

From: Geert Josten <geert.josten@daidalos.nl>
Date: Thu, 22 Sep 2011 12:59:05 +0200
To: Romain Deltour <rdeltour@gmail.com>, XProc Comments <public-xml-processing-model-comments@w3.org>
CC: XProc Dev <xproc-dev@w3.org>
Message-ID: <B26C615F8546A84C81165A7BC8BE61A020F827E760@EXMBXC01.ms-hosting.nl>
Hi Romain,

Interesting! I had similar problems when I tried to rely on base-uri to keep track from which file certain (processed) trees came from. I was forced to use base-uri(/*) to work around this problem. I am not sure though that setting a xml:base attribute on the root element to change the base-uri of the document node is the best solution.

First of all, I am curious what the XML Base spec would say about the difference between the two (base-uri of document node versus xml:base on root element), does it distinguish between the two?

Secondly, I would make more sense to me to have a p:change-base-uri step that *would* allow changing the base-uri property of the document node.


Kind regards,

-----Oorspronkelijk bericht-----
Van: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] Namens Romain Deltour
Verzonden: donderdag 22 september 2011 0:52
Aan: XProc Comments
CC: XProc Dev
Onderwerp: document base uri


It seems the general approach for XProc steps is that if an attribute  
named "xml:base" is added (or changed), the base URI of the underlying  
element MUST be updated [1].

However, there seems to be no simple way [*] to change the base URI of  
a *document* flowing through a pipeline. This makes the no-arg p:base- 
uri() function (returning the context document base URI) very brittle  
whenever @xml:base is manipulated.

I think it would be better to say: if an attribute named "xml:base" is  
added (or changed), the base URI of the underlying element MUST be  
updated ; if the underlying element is the root element, the base URI  
of the document MUST be updated.

Note that the introduction of section 7 [2] is confusing for the same  
	"When a step in this library produces an output document, the base  
URI of the output is the base URI of the step's primary input document  
unless the step's process explicitly sets an xml:base attribute (...)"

Comments welcome!

[1] http://lists.w3.org/Archives/Public/public-xml-processing-model-comments/2009Jan/0040.html
[2] http://www.w3.org/TR/xproc/#std-components
[*] I tried several solutions:

    a) adding an @xml:base (e.g. with p:add-attribute) affects an  
element, not the document node.

    b) using a p:xslt with @output-base-uri and an identity XSLT seems  
to work with XSLT 1.0-enabled processors (e.g. Calumet), not with XSLT  
2.0-enabled ones (e.g. Calabash).
I suppose it's because Calumet uses XSLT 1.0 ("An XSLT 1.0 step should  
use the value of the output-base-uri as the base URI of its output")  
and Calabash XSLT 2.0 (which doesn't specifies, as far as I  
understood, that the base output URI sets the base URI of an  
implicitly constructed final result tree).

    c) I could get something working by using an XSLT 2.0 identity  
that writes on an explicit xsl:result-document, then discarding the  
main result port, wrapping/unwrapping the secondary sequence port to  
get the single result document.

I attached some XProc documents showing the approaches described above.

Romain Deltour, Software Developer
The DAISY Consortium
Received on Thursday, 22 September 2011 10:59:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:28:27 UTC