If you are using XSLT 2.0, then doc-available(). Only works for XML documents,
but that's what you are doing below.
Andy.
-----Original Message-----
From: Calvados Boulard [mailto:calvados(_dot_)boulard(_at_)gmail(_dot_)com]
Sent: Thursday, February 04, 2010 06:55 PM
To: xsl-list
Subject: [xsl] How to gracefully check if a document exists relative to
the document being transformed?
Hi there,
I'm transforming a XML document, and attempting to determine if a file
at a relative location exists.
The file as you would guess from the relative path exists one
directory up, and in another directory
Currently I'm using:
<xsl:choose>
<xsl:when test="unparsed-text-available('../06_Regulations
Point in Time/125_2008_pit.xml')">
<h1>Document found</h1>
</xsl:when>
<xsl:otherwise>
<h1>Document NOT found</h1>
</xsl:otherwise>
</xsl:choose>
However the unparsed-text-available only seems to check for the target
document relative to the location of the XSL file, not the XML.
I've also tried:
<xsl:choose>
<xsl:variable name="common-uri"
select="resolve-uri('../06_Regulations Point in
Time/125_2008_pit.xml')" />
<xsl:choose>
<xsl:when test="unparsed-text-available($common-uri)">
<h1>Document found</h1>
</xsl:when>
<xsl:otherwise>
<h1>Document NOT found</h1>
</xsl:otherwise>
</xsl:choose>
as well as:
<xsl:choose>
<xsl:when
test="unparsed-text-available(document(''../06_Regulations Point in
Time/125_2008_pit.xml',/))">
<h1>Document found</h1>
</xsl:when>
<xsl:otherwise>
<h1>Document NOT found</h1>
</xsl:otherwise>
</xsl:choose>
How would I go about gracefully checking to see if the document exists
relative to the document being transformed? I see that the document
function has a way to enforce checking relative locations, but am
unsure how to put this all together.
Thanks for all your help.
Cal.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--