Re: [xsl] Please Confirm that xsl:document instruction cannot have a document URI

Subject: Re: [xsl] Please Confirm that xsl:document instruction cannot have a document URI
From: Eliot Kimber <ekimber@xxxxxxxxxx>
Date: Thu, 29 Aug 2013 08:07:03 -0500
I tried this:

<xsl:document xml:base="{$base-uri}">

But xml:base is not an attribute value template, so no joy there. (This
means that there's no way I can see to set the base URI to a dynamic value,
which does seem like an oversight.)

Since what I wanted to do was the use the same URI as my initial input
document, I just did this in the template that generates the result document
from the input element:

   <map class="- map/map " xml:base="{base-uri(.)}">


Cheers,

Eliot

On 8/28/13 2:43 PM, "Eliot Kimber" <ekimber@xxxxxxxxxx> wrote:

> Ah, so the error is in using document-uri() as the base for resolving
> relative URIs, rather than base URI. That makes sense.
>
> Thanks,
>
> Eliot
>
> On 8/28/13 12:01 PM, "Michael Kay" <mike@xxxxxxxxxxxx> wrote:
>
>> There's a difference between document-uri and base-uri. document-uri is a
URI
>> that can be used to fetch the document using the doc() function. base-uri
is
>> a
>> URI that can be used to resolve relative URIs contained in the document.
You
>> talk about document-uri, but I think you mean base-uri.
>>
>> As David points out, you can control the base URI of the constructed
document
>> using an xml:base attribute in the stylesheet.
>>
>> You can't set a document URI (it's a temporary tree with no means of
external
>> identification. That means that the garbage collector knows when it can
kill
>> it. This wouldn't be the case if it had a document URI. If you want to
create
>> a document with a document URI, use xsl:result-document - except you can't
>> then access it during the same transformation.)
>>
>> Michael Kay
>> Saxonica
>>
>>
>> On 28 Aug 2013, at 17:17, Eliot Kimber wrote:
>>
>>> I tried to find an answer to this question but neither Google nor
MarkMail
>>> revealed a definitive answer.
>>>
>>> I have code that constructs a document using <xsl:document> and then
passes
>>> it to a 3rd-party function library that expects the input document to have
a
>>> URI so that it can then resolve relative URI references.
>>>
>>> Based on my reading of the XSLT 2 spec and what I could find in my
searches,
>>> it appears that there is no standard way to define a document URI for
>>> documents created using <xsl:document>.
>>>
>>> This seems like a bit of an oversight in the spec, so I wanted to get
>>> confirmation that my analysis is correct, that I cannot use
<xsl:document>
>>> alone as input to functions that expect to get a non-null document-uri()
>>> value.
>>>
>>> Thanks,
>>>
>>> Eliot
>>> --
>>> Eliot Kimber
>>> Senior Solutions Architect, RSI Content Solutions
>>> "Bringing Strategy, Content, and Technology Together"
>>> Main: 512.554.9368
>>> www.rsicms.com
>>> www.rsuitecms.com
>>> Book: DITA For Practitioners, from XML Press,
>>> http://xmlpress.net/publications/dita/practitioners-1/
>>
>
> --
> Eliot Kimber
> Senior Solutions Architect, RSI Content Solutions
> "Bringing Strategy, Content, and Technology Together"
> Main: 512.554.9368
> www.rsicms.com
> www.rsuitecms.com
> Book: DITA For Practitioners, from XML Press,
> http://xmlpress.net/publications/dita/practitioners-1/
>

--
Eliot Kimber
Senior Solutions Architect, RSI Content Solutions
"Bringing Strategy, Content, and Technology Together"
Main: 512.554.9368
www.rsicms.com
www.rsuitecms.com
Book: DITA For Practitioners, from XML Press,
http://xmlpress.net/publications/dita/practitioners-1/

Current Thread