Subject: [xsl] How to gracefully check if a document exists relative to the document being transformed? From: Calvados Boulard <calvados.boulard@xxxxxxxxx> Date: Thu, 4 Feb 2010 15:55:20 -0800 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to test with XPath th, Abel Braaksma | Thread | RE: [xsl] How to gracefully check i, Houghton,Andrew |
Re: [xsl] are all strings in a sequ, G. Ken Holman | Date | RE: [xsl] How to gracefully check i, Houghton,Andrew |
Month |