[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to gracefully check if a document exists relative
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|