doc('') stopped working in p:xslt
Closed this issue · 8 comments
In XSLT, doc('')
, which is working fine on 1.3.2-100, does not work on 1.5.4-100:
$ cat pipe.xpl
<?xml version="1.0"?>
<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
<p:input port="source">
<p:empty />
</p:input>
<p:output port="result" />
<p:xslt>
<p:input port="source">
<p:inline>
<test />
</p:inline>
</p:input>
<p:input port="stylesheet">
<p:document href="test.xsl" />
</p:input>
<p:input port="parameters">
<p:empty />
</p:input>
</p:xslt>
</p:declare-step>
$ cat test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="test">
<xsl:sequence select="doc('')" />
</xsl:template>
</xsl:stylesheet>
$ java -cp xmlcalabash-1.3.2-100/xmlcalabash-1.3.2-100.jar:slf4j-simple-1.7.36.jar com.xmlcalabash.drivers.Main pipe.xpl
[main] INFO org.xmlresolver.ResourceCache - Not caching: file:/tmp/test/test.xsl
[main] INFO org.xmlresolver.ResourceCache - Not caching: file:/tmp/test/test.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
<xsl:template match="test">
<xsl:sequence select="doc('')"/>
</xsl:template>
</xsl:stylesheet>
$ java -cp xmlcalabash-1.5.4-100/xmlcalabash-1.5.4-100.jar:slf4j-simple-1.7.36.jar com.xmlcalabash.drivers.Main pipe.xpl
Error on line 1 column 1 of file:/tmp/test/:
SXXP0003 Error reported by XML parser: Content is not allowed in prolog.: Content is not
allowed in prolog.
[main] ERROR com.xmlcalabash.util.DefaultXProcMessageListener - org.xml.sax.SAXParseException; systemId: file:/tmp/test/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
[main] ERROR com.xmlcalabash.util.DefaultXProcMessageListener - cause: file:/tmp/test/test.xsl:4:4:err:FODC0002:org.xml.sax.SAXParseException; systemId: file:/tmp/test/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
[main] ERROR com.xmlcalabash.drivers.Main - Pipeline failed: org.xml.sax.SAXParseException; systemId: file:/tmp/test/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
[main] ERROR com.xmlcalabash.drivers.Main - Underlying exception: org.xml.sax.SAXParseException; systemId: file:/tmp/test/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
$
Ugh. I'll take a look. All that base uri/document uri stuff is a bit awful.
Fascinating. 1.5.3-100 works fine, 1.5.4-100 doesn't and it is not at all obvious how the changes could have this effect.
Fixed in 1.5.5. The real culprit was a bug in XML Resolver so 1.5.5-100 really only updates the version of the resolver. If you continue to have problems, make sure that you arrange the classpath so that XML Resolver 5.1.3 is used, not the version referenced from the Saxon release.
The real culprit was a bug in XML Resolver so 1.5.5-100 really only updates the version of the resolver. If you continue to have problems, make sure that you arrange the classpath so that XML Resolver 5.1.3 is used
@ndw : I see that 1.5.5-100 has XML Resolver 5.1.3 in the lib directory and refers to 5.1.3 in the manifest. However, 1.5.5-110 still has XML Resolver 5.1.2 in the lib directory and refers to 5.1.2 in the manifest. Is that what you intended?
Uuuugggghhhh. No, that's a complete fail on my part. And one I can't explain. I guess 1.5.6 is coming up...
Right. I've published 1.5.6 which fixes this error. Sorry about that.
Thanks a lot! Version 1.5.6-110 indeed behaves as expected in the situation where I had seen the problem.
👍