[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[XSL] unparsed-text with relative URI's

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.