Re: [xsl] [XSL] unparsed-text with relative URI's

Subject: Re: [xsl] [XSL] unparsed-text with relative URI's
From: Calvados Boulard <calvados.boulard@xxxxxxxxx>
Date: Mon, 22 Feb 2010 15:44:16 -0800
Thanks Michael, using resolve-uri($regpit, base-uri(/)) did the trick.

By relative document, I meant to say a document that was in a location
relative to the document being transformed. i.e.
../../directory/file.xml

Thanks again.

On Fri, Feb 12, 2010 at 16:34, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>>
>> I'm wondering how to set the base URI's static context
>> relative to that of the file being transformed.
>
> Eh? The static context includes a base URI. The base URI does not have a
> static context. Is this just a typo, or are you seriously confused about
> concepts?
>>
>> I've currently got my xsl located at
>> http://site1.ca/styles/myxsl.xsl, and am transforming a
>> document located at http://site2.ca/documents/mydocument.xml
>
> And where is the file whose existence you are trying to test?
>>
>> My xsl builds the location of the relative file, and attempts
>> to test for it's existence as below:
>
> There's no such thing as a "relative file", I'm not sure what you mean. And
> I can't see how the names used in this code relate to your site1.ca and
> site2.ca given above.
>>
>> <xsl:variable name="regpit" select="concat('../06_Regulations
>> Point in Time/',concat(translate(/reg/regnum, '/', '_'),
>> '_pit.xml'))"/> <xsl:if
>> test="unparsed-text-available(resolve-uri($regpit))">
>
> resolve-uri() with one argument resolves against the static base URI (that
> is, the location of the stylesheet). Which is exactly what
> unparsed-text-available() would do anyway. So this can't be right. If you
> want to resolve against the location of the source document, use
> resolve-uri($regpit, base-uri(/)).
>
> Regards,
>
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay

Current Thread