Re: Bug with p:add-xml-base?

Roger,

The base URI of a document is its full location (unless you override  
it with xml:base). Other URIs are resolved relative to this base URI  
using the rules in RFC 3986 [1], which basically strip off the final  
component (the filename) before appending a new relative URI, in order  
to create a new URI. So with a base URI of:

   file:/C:/xproc/example/BookStore.xml

and a relative URI of:

   siddhartha/Siddhartha.xml

the resolved URI is:

   file:/C:/xproc/example/siddhartha/Siddhartha.xml

Cheers,

Jeni

[1]: http://tools.ietf.org/html/rfc3986

On 6 Jun 2009, at 16:47, Costello, Roger L. wrote:

>
> Hi Folks,
>
> I have a simple pipeline that uses p:add-xml-base:
>
> -----------------------------------------------------
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
>
>    <p:input port="source">
>        <p:document href="BookStore.xml"/>
>    </p:input>
>
>    <p:output port="result">
>        <p:pipe step="store" port="result"/>
>    </p:output>
>
>    <p:add-xml-base />
>
>    <p:store href="result.xml" name="store"/>
>
> </p:declare-step>
> -----------------------------------------------------
>
>
> The file that is stored, result.xml, is the BookStore with xml:base  
> added to the root element:
>
> <BookStore xml:base="file:/C:/xproc/example/BookStore.xml">
>    ...
> </BookStore>
>
>
> Is that value for xml:base correct? It doesn't seem correct.
>
> I think it should be:
>
>   file:/C:/xproc/example/
>
>
> If the xml:base is:
>
>   file:/C:/xproc/example/BookStore.xml
>
> then I can't see how p:xinclude could work.
>
> That is, if I put this include statement in BookStore.xml:
>
>    <xi:include href="siddhartha/Siddhartha.xml" />
>
> The absolute URL is the value of xml:base plus the relative URL:
>
>    file:/C:/xproc/example/BookStore.xml/siddhartha/Siddhartha.xml
>
> which is clearly wrong (and which explains why I get an error  
> whenever I use p:xinclude)
>
> What am I missing?
>
> /Roger
>

-- 
Jeni Tennison
http://www.jenitennison.com

Received on Saturday, 6 June 2009 19:38:04 UTC