Project

Profile

Help

Two issues using xsl:result-document with a relative URI

Added by Martin Honnen over 4 years ago

Using Saxon-JS 2 on Windows 10 with Node.js version v12.18.0 I have encountered two problems:

  1. When I use xsl:result-document with a relative URI I would expect the result to be written to the current working directory the XSLT file is loaded from; however, the result is being written to the parent directory:
E:\XSLT\Saxon-JS>xslt3 -t -it -xsl:result-document-test1.xsl
Saxon-JS 2.0 from Saxonica
Node.js version v12.18.0
Compiling stylesheet E:\XSLT\Saxon-JS\result-document-test1.xsl
Stylesheet compilation time: 0.128s
Initial template: Q{http://www.w3.org/1999/XSL/Transform}initial-template
SEF generated by Saxon-JS 2.0 at 2020-06-14T20:34:20.751+02:00 with -target:JS -relocate:true
Writing to file:///E:/XSLT/result-document-test-1.html
Writing to file:///E:/XSLT/result-document-test-2.html
Writing to file:///E:/XSLT/result-document-test-3.html

Code is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" expand-text="yes">
    
    <xsl:template name="xsl:initial-template">
        <xsl:iterate select="1 to 3">
            <xsl:result-document href="result-document-test-{.}.html">
                <html>
                    <body>
                        <h1>Result document {.}</h1>
                    </body>
                </html>
            </xsl:result-document>
        </xsl:iterate>
    </xsl:template>
    
</xsl:stylesheet>

When I run Saxon 10 HE Java in that directory with those command line options, the result files end up in the working directory E:\XSLT\Saxon-JS and not in the parent E:\XSLT.

  1. When I try to run the above code in a directory where the name of an ancestor directory contains a space Saxon (or Node) seems to try to write to a directory with the space in the name being percent escaped (e.g. C:\Users\John%20Doe\xslt) which seems wrong on the file system level where the %20 should be converted to a space.

    (1-1/1)

    Please register to reply