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

xprocdoc not working with Calabash #80

Closed
vojtechtoman opened this issue Feb 19, 2013 · 5 comments
Closed

xprocdoc not working with Calabash #80

vojtechtoman opened this issue Feb 19, 2013 · 5 comments

Comments

@vojtechtoman
Copy link

@vojtechtoman vojtechtoman commented Feb 19, 2013

I was trying to run my xprocdoc pipeline (http://github.com/vojtechtoman/xprocdoc) with Calabash and I ran into a number of issues.

The pipeline works with Calumet and is supposed to be processor-independent, but I failed to make it work with Calabash.

  1. Suppose you have this pipeline (pipeline.xpl):

    <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
      <p:documentation xmlns="http://www.w3.org/1999/xhtml">
        <p>Documentation</p>
      </p:documentation>
      <p:identity/>
    </p:pipeline>
    

    then calling:

    calabash -i source=pipeline.xpl xprocdoc.xpl
    

    will fail with:

    Feb 19, 2013 12:28:37 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: file:///home/vojtech/Dev/xprocdoc/a.xpl:err:XTSE0150:The supplied file does not appear to be a stylesheet
    Feb 19, 2013 12:28:37 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: file:///home/vojtech/Dev/xprocdoc/a.xpl:err:XTSE0150:The supplied file does not appear to be a stylesheet
    Feb 19, 2013 12:28:37 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: Failed to compile stylesheet. 1 error detected.
    Feb 19, 2013 12:28:37 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: Failed to compile stylesheet. 1 error detected.
    Feb 19, 2013 12:28:37 PM com.xmlcalabash.drivers.Main error
    SEVERE: Pipeline failed: net.sf.saxon.s9api.SaxonApiException: Failed to compile stylesheet. 1 error detected.
    Feb 19, 2013 12:28:37 PM com.xmlcalabash.drivers.Main error
    SEVERE: Underlying exception: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
    

    It turns out that somehow this does not work in Calabash:

    <p:declare-step type="xd:summary-to-xhtml" name="summary-to-xhtml">
      <p:input port="source" primary="true"/>
      <p:input port="stylesheet">
        <p:document href="xd2html.xsl"/>
      </p:input>
      <p:input port="parameters" kind="parameter"/>
      <p:output port="result" sequence="true"/>
    
      <p:xslt version="2.0" name="xslt">
        <p:input port="stylesheet">
          <p:pipe step="summary-to-xhtml" port="stylesheet"/>
        </p:input>
      </p:xslt>
      ...
    

    Once I replace the p:pipe in p:xslt with <p:document href="xd2html.xsl"/>, the p:xslt step does not complain anymore.

  2. After applying the above mentioned workaround, the pipeline still does not run:

    Feb 19, 2013 12:49:14 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: err:XD0001:XD0001
    Feb 19, 2013 12:49:14 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: err:XD0001:XD0001
    Feb 19, 2013 12:49:14 PM com.xmlcalabash.drivers.Main error
    SEVERE: It is a dynamic error if a non-XML resource is produced on a step output or arrives on a step input.
    

    At this point I gave up :)

  3. Also note that if you do

    calabash -i source=xprocdoc.xpl xprocdoc.xpl
    

    Calabash fails with:

    Feb 19, 2013 12:50:36 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.util.DefaultXProcMessageListener error
    SEVERE: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.drivers.Main error
    SEVERE: com.xmlcalabash.core.XProcException: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    Feb 19, 2013 12:50:36 PM com.xmlcalabash.drivers.Main error
    SEVERE: Underlying exception: net.sf.saxon.s9api.SaxonApiException: Cannot create a namespace node (xd) whose parent is a document node
    
@fgeorges
Copy link

@fgeorges fgeorges commented Feb 19, 2013

Exactly the same as me :-) For 3., this is because the variables $namespace-uri. The value of both of them is a namespace node. Explicitly taking their string value solve the error, but that is a bug IMHO (changing namespace::*[...] into namespace::*[...]/string(.) solves the problem).

@ndw
Copy link
Owner

@ndw ndw commented Mar 8, 2013

After fixing the namespace bug, the problem remains.

It appears that XML Calabash always connects input ports to the default readable port, whether they are primary nor not. Re-reading the spec, I think that's wrong. :-)

@ndw
Copy link
Owner

@ndw ndw commented Mar 8, 2013

Ok, after I (think) I've fixed that, I get:

SEVERE: file:/Volumes/Data/github/xprocdoc/xd2html.xsl:56:err:FORG0002:Base URI {} is not an absolute URI
SEVERE: Base URI {} is not an absolute URI
SEVERE: Base URI {} is not an absolute URI
SEVERE: Pipeline failed: net.sf.saxon.s9api.SaxonApiException: Base URI {} is not an absolute URI
SEVERE: Underlying exception: net.sf.saxon.trans.XPathException: Base URI {} is not an absolute URI
net.sf.saxon.s9api.SaxonApiException: Base URI {} is not an absolute URI
at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:433)
at com.xmlcalabash.library.XSLT.run(XSLT.java:230)
at com.xmlcalabash.runtime.XAtomicStep.run(XAtomicStep.java:381)

Which looks like a pipeline bug to me. Where/how is the $output-base-uri parameter set?

@vojtechtoman
Copy link
Author

@vojtechtoman vojtechtoman commented Mar 8, 2013

The xd2html.xsl stylesheet recognizes 4 parameters: output-base-uri, input-base-uri, product, and overview-file (see the project README for more details). All of them are optional, but I have clearly never tested the pipeline without specifying output-base-uri. Should be fixed now. Can you give it another try?

The parametere were passed to the stylesheet as normal XProc parameters (so you had to pass them via xd:xprocdoc's parameter input port). I decided to make them XProc options to make their existence more explicit.

I have also put some xprocdoc-style documentation in the pipeline. So you can now use the pipeline to generate its own XHTML documentation :)

(Note that I have also changed the namespace uri of the xd:xprocdoc to something more meaningful.)

ndw added a commit that referenced this issue Mar 8, 2013
@ndw
Copy link
Owner

@ndw ndw commented Mar 8, 2013

Yep. That works. Thanks, Vojtech!

@ndw ndw closed this Mar 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.