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

Subject: [xsl] [XSL] unparsed-text with relative URI's
From: Calvados Boulard <calvados.boulard@xxxxxxxxx>
Date: Fri, 12 Feb 2010 15:45:52 -0800
Hi there,

I'm attempting to determine the existence of a document relative the
the document being transformed.

According to http://www.w3.org/TR/xslt20/ :
When using unparsed-text the $href argument must be a string in the
form of a URI. The URI must contain no fragment identifier, and must
identify a resource that can be read as text. If the URI is a relative
URI, then it is resolved relative to the base URI from the static
context.
If a different base URI is appropriate (for example, when resolving a
relative URI read from a source document) then the relative URI should
be resolved using the  resolve-uri  function before passing it to the
unparsed-text  function.

I'm wondering how to set the base URI's static context relative to
that of the file being transformed.

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

My xsl builds the location of the relative file, and attempts to test
for it's existence as below:

<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))">
	<xsl:call-template name="createregpitlink">
		<xsl:with-param name="regpitpath" select="$regpit"/>
	</xsl:call-template>
</xsl:if>


I've tried using the document function, and this seems to work when
I'm working locally on my workstation, but once posted to the server,
it fails to work.  Is there perhaps a cross domain issue with this
considering the locations mentioned above?
<xsl:variable name="regpit" select="concat('../06_Regulations Point in
Time/',concat(translate(/reg/regnum, '/', '_'), '_pit.xml'))"/>
<xsl:if test="document($regpit,/)">
	<xsl:call-template name="createregpitlink">
		<xsl:with-param name="regpitpath" select="$regpit"/>
	</xsl:call-template>
</xsl:if>
<xsl:variable name="regpit" select="concat('../',$regpit)"/>
        <xsl:if test="document($regpit,/)">
		<xsl:call-template name="createregpitlink">
			<xsl:with-param name="regpitpath" select="$regpit"/>
	</xsl:call-template>
</xsl:if>


Any help, or suggestions as how I could accomplish this would be
greatly appreciated.

Thanks,

Current Thread