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

Different treatment of empty primary p:xslt results in 1.1.25-99 #288

Closed
gimsieke opened this issue Mar 31, 2019 · 4 comments
Closed

Different treatment of empty primary p:xslt results in 1.1.25-99 #288

gimsieke opened this issue Mar 31, 2019 · 4 comments

Comments

@gimsieke
Copy link
Contributor

Thank you for 1.1.25-99. Together with Saxon 9.9.1.2, it certainly solves issue #281. Apart from that, almost everything else seems to work as expected. I employed it in a configuration with complex and diverse pipelines and many test documents. There were differences in attribute order and in indentation (end tags no longer in a line of their own, which is a plus). This is certainly due to changes in Saxon 9.9, they are Ok.

I stumbled over one kind of new error in our pipelines, and I boiled it down to this example:

Untitled4.xpl

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" 
  xmlns:cx="http://xmlcalabash.com/ns/extensions"
  xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0" name="mystep">

  <p:input port="source" primary="true">
    <p:inline><doc/></p:inline>
  </p:input>

  <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
  
  <p:xslt name="xslt">
    <p:input port="parameters">
      <p:empty/>
    </p:input>
    <p:input port="stylesheet">
      <p:document href="Untitled3.xsl"/>
    </p:input>
  </p:xslt>
  
  <p:sink/>
  
  <p:for-each>
    <p:iteration-source>
      <p:pipe port="secondary" step="xslt"/>
      <p:pipe port="result" step="xslt"/>
    </p:iteration-source>
    <cx:message>
      <p:with-option name="message" select="base-uri(), ' :: ', count(/), ' :: ', count(/node())"/>
    </cx:message>
    <p:store>
      <p:with-option name="href" select="concat(base-uri(), '.new')"/>
    </p:store>
  </p:for-each>
  
</p:declare-step>

Untitled3.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0">
  <xsl:template match="/">
    <xsl:result-document href="f">
      <xsl:copy-of select="node()"/>
    </xsl:result-document>
  </xsl:template>
</xsl:stylesheet>

This stylesheet doesn’t produce a primary output.

With 1.1.21 and Saxon 9.8, I get the following message:

Message: file:/C:/cygwin/home/gerrit/Dev/Calabash/xmlcalabash-1.1.21-98/f :: 1 :: 1

With 1.1.25 and Saxon 9.9, I get this:

Message: file:/C:/cygwin/home/gerrit/Dev/Calabash/xmlcalabash-1.1.25-99/f :: 1 :: 1
Message: file:/C:/cygwin/home/gerrit/Dev/Calabash/Untitled4.xpl :: 1 :: 0
ERROR: Pipeline failed: null

The error happens when p:store tries to store the empty document node that 1.1.25-99 returned on the primary p:xslt port.

I think in XProc 1.0, p:xslt needs to produce exactly one well-formed XML document on the result port. So I think that Calabash should probably raise an error if my stylesheet fails to produce a primary result document. (I remember that @xml-project mentioned that his processor will report this as an error.)

@ndw
Copy link
Owner

ndw commented Apr 1, 2019

That certainly wasn’t an intentional change and I agree an error should be raised. Will see if I can fix it today.

@ndw
Copy link
Owner

ndw commented Apr 3, 2019

Right. I've made progress using the RawDestination that Michael Kay suggested. It passes the obvious test but fails seven tests in regression. Will investigate and (hopefully) have patch tomorrow.

ndw added a commit that referenced this issue Apr 3, 2019
@ndw
Copy link
Owner

ndw commented Apr 3, 2019

Fixed, I believe. 1.1.26-99 is available here and will be available in Maven shortly.

@ndw ndw closed this as completed Apr 3, 2019
@gimsieke
Copy link
Contributor Author

gimsieke commented Apr 4, 2019

Thanks, it now behaves as it did before.

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

2 participants