[xslt] absolute paths in document() don't work on Windows



If you run the stylesheet below with the XSL stylesheet specified on the 
command line with a relative path (i.e. xsltproc styles\style1.xsl 
input.xml) xsltproc 1.1.3 (the latest available Windows binary) will 
generate errors regardless of how I try to 'force' xsltproc to believe the 
document path is absolute.
The first attempt fails because xsltproc tacks on the relative path the 
stylesheet is in, giving the URI encoded equivalent of 'styles\c:\test.xml'
The second attempt fails because xsltproc tacks on the initial slash, 
producing '/c:\test.xml' and probably angering Windows.

If an absolute path is specified for the XSL stylesheet (i.e. xsltproc 
c:\styles\style1.xsl input.xml) xsltproc fails one way and succeeds the 
other way.
The first attempt produces the URI encoded equivalent of 
'file:///c:\styles\style1.xsl\c:\test.xml'
The second attempt produces the correct path 'file:///c:\test.xml'




<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:str="http://exslt.org/strings";
                extension-element-prefixes="str"
                version='1.1'>

<xsl:template match="*">

<xsl:value-of select="document(str:encode-uri('c:\test.xml', 'UTF-8'))" />
<xsl:value-of select="document(str:encode-uri('/c:\test.xml', 'UTF-8'))" />

</xsl:template>

</xsl:stylesheet>



Thanks,

Yuval

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]