Test whether file exists
Posted: Fri Mar 24, 2017 11:30 pm
I'm creating a transformation during which I need to know whether a file exists. I found this solution online:
but after adding this to my stylesheet, the test always fails, but I'm not seeing any error message. (The named file is in the same directory as the stylesheet itself.)
My transformation is running with Saxon-PE 9.6.0.7.
Where do I start to troubleshoot this?
Code: Select all
<xsl:choose>
<xsl:when test="fs:exists(fs:new('AJS405045.xml'))" xmlns:fs="java.io.File">
<xsl:message><xsl:text>Found it!</xsl:text></xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message><xsl:text>Missing!</xsl:text></xsl:message>
</xsl:otherwise>
</xsl:choose>
My transformation is running with Saxon-PE 9.6.0.7.
Where do I start to troubleshoot this?