[Home] [By Thread] [By Date] [Recent Entries]
Hi all,
I have the following directory/file structure: common/
|- core.xsl
a/
|- 1.xsl
docs/
|- document.xmlThat is, three directories (common, a, and docs), each with one file (core.xsl, 1.xsl, and document.xsl, respectively). Further, let's say that these directories live at the absolute path file:///z:/work/dev/xslt. In core.xsl, I have this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xml:base="file:///z:/work/dev/xslt"> <xsl:include href="a/1.xsl"/> <xsl:variable name="doc" select="document('docs/doc.xml')"></xsl:variable> <xsl:template match="node() | @*">
<xsl:apply-templates select="node() | @*"/>
</xsl:template></xsl:stylesheet> (Notice the xml:base attribute on the xsl:stylesheet element.) Executing a transformation in the following way: bfh@halibut /cygdrive/z/work/dev/xslt $ java -jar saxon8.jar data.xml common/core.xsl produces the error Error at xsl:include on line 5 of file:/z:/work/dev/xslt/common/core.xsl: XTSE0165: java.io.FileNotFoundException: z:\work\dev\a\1.xsl (The system cannot find the path specified) Failed to compile stylesheet. 1 error detected. If I comment out the xsl:include, the call to the document() function produces a similar error. Recoverable error on line 7 of file:/z:/work/dev/xslt/common/core.xsl: FODC0005: java.io.FileNotFoundException: z:\work\dev\docs\doc.xml (The system cannot find the path specified) Error on line 7 of file:/z:/work/dev/xslt/common/core.xsl: FODC0005: Failed to load document docs/doc.xml Transformation failed: Run-time errors were reported In both cases, the processor seems to be setting the base-uri to file:///z:/work/dev, not file:///z:/work/dev/xslt as is specified. However, when I change the stylesheet to the following: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:include href="../a/1.xsl"/> <xsl:variable name="doc" select="doc('../docs/doc.xml')"></xsl:variable> <xsl:template match="node() | @*">
<xsl:apply-templates select="node() | @*"/>
<xsl:value-of select="$doc"/>
</xsl:template></xsl:stylesheet> (I've removed xml:base and changed both the xsl:include's href attribute and the argument to the document function.) The transformation now runs as expected. What am I misunderstanding? I thought xml:base provided a baseline for all URIs/paths. Is that not the case? Thanks in advance for any help! Regards --Bill
|

Cart



