Project

Profile

Help

Bug #2037 » file-exists.xsl

Stefan Krause, 2014-03-23 17:43

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:file="http://expath.org/ns/file"
version="2.0"
exclude-result-prefixes="#all">
<xsl:template match="/">
<xsl:variable name="file" as="xs:string" select="string(document-uri(/))"/>
<root>
<test>
<xsl:text>document-uri(/): </xsl:text><xsl:value-of select="$file"/>: <xsl:value-of select="file:exists($file)"/>
</test>
<xsl:variable name="file2" as="xs:string" select="substring-after($file, 'file:')"/>
<test>
<xsl:text>native path: </xsl:text><xsl:value-of select="$file2"/>: <xsl:value-of select="file:exists($file2)"/>
</test>
<xsl:variable name="file3" as="xs:string" select="file:path-to-native($file)"/>
<test>
<xsl:text>file:path-to-native(): </xsl:text><xsl:value-of select="$file3"/>: <xsl:value-of select="file:exists($file3)"/>
</test>
</root>
</xsl:template>
</xsl:stylesheet>
(1-1/2)