Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc('') stopped working in p:xslt #343

Closed
AirQuick opened this issue May 5, 2023 · 8 comments
Closed

doc('') stopped working in p:xslt #343

AirQuick opened this issue May 5, 2023 · 8 comments

Comments

@AirQuick
Copy link

AirQuick commented May 5, 2023

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.
$ 
@ndw
Copy link
Owner

ndw commented May 6, 2023

Ugh. I'll take a look. All that base uri/document uri stuff is a bit awful.

@ndw
Copy link
Owner

ndw commented May 7, 2023

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.

@ndw
Copy link
Owner

ndw commented May 7, 2023

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.

@galtm
Copy link

galtm commented May 10, 2023

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?

@ndw
Copy link
Owner

ndw commented May 11, 2023

Uuuugggghhhh. No, that's a complete fail on my part. And one I can't explain. I guess 1.5.6 is coming up...

@ndw
Copy link
Owner

ndw commented May 11, 2023

Right. I've published 1.5.6 which fixes this error. Sorry about that.

@galtm
Copy link

galtm commented May 11, 2023

Thanks a lot! Version 1.5.6-110 indeed behaves as expected in the situation where I had seen the problem.

@ndw
Copy link
Owner

ndw commented May 11, 2023

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants