Project

Profile

Help

Difference between Saxon Java and Saxon-JS 2 when using xsl:result-document with no href attribute and no -o option

Added by Martin Honnen over 3 years ago

I have a question about a difference I noted between Saxon Java (tested with HE 10.3) and Saxon-JS 2 when running a stylesheet from the command line that uses xsl:result-document without a href attribute and no -o option set for the command line invocation. Saxon Java writes that output to the console e.g. a stylesheet like

<?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"
    exclude-result-prefixes="#all"
    expand-text="yes"
    version="3.0">
    
    <xsl:template match="/">
        <xsl:result-document>
            <root>{current-dateTime()}</root>
        </xsl:result-document>
    </xsl:template>
    
</xsl:stylesheet>

when run against any XML input creates an output in the console of e.g.

<?xml version="1.0" encoding="UTF-8"?><root>2021-04-02T12:20:38.308+02:00</root>

while Saxon JS 2 gives an error indicating it tries to open the current directory (to write the result to it?):

<?xml version="1.0" encoding="UTF-8"?>[Error: EISDIR: illegal operation on a directory, open 'C:\Users\marti\SomePath\base-output-uri'] {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'open',
  path: 'C:\\Users\\marti\\SomePath\\base-output-uri'
}

Perhaps the two products can be aligned to both write to the console or the difference of Saxon JS 2 could be documented.


Please register to reply