XSL import usage for locating relative file paths on Windows

xslt

Solution

To be sure, the front-slash characters are the ones to be used, i.e.

<xsl:import href="..\..\..\Dependencies\XSL\xsl\htmlhelp\htmlhelp.xsl"/>

is positively incorrect, not need to pursue this track.

The issue may be that the "Base URI" (as defined in RFC 2396) is not what we expect. Although I believe the standard is explicit about rules pertaining to the determination of the base URI, there is some ambiguity with various xslt processors.

If you are w/ XSLT 2.0 you may try to use fn:base-uri() to see that this URI is indeed the one you'd expect.

Problem

I have a simple XSL file which looks like: ``` <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="html/docbook.xsl"/> </xsl:stylesheet> ``` I have an XSL file which lies in a folder on the disk (not on the web). It's path relative to my XSL file (above) is: ``` ..\..\..\Dependencies\XSL\xsl\htmlhelp\htmlhelp.xsl <xsl:import href="..\..\..\Dependencies\XSL\xsl\htmlhelp\htmlhelp.xsl"/> ``` or ``` <xsl:import href="../../../Dependencies/XSL/xsl/htmlhelp/htmlhelp.xsl"/> ``` doesn't seem to be working (I get - can not find file - errors from xslproc tool.) What is the proper way of writing relative paths in the XSL:import ? Thanks in advance, Paul

Original source