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

NVDL validation #283

Closed
raghnysh opened this issue Oct 27, 2018 · 9 comments
Closed

NVDL validation #283

raghnysh opened this issue Oct 27, 2018 · 9 comments

Comments

@raghnysh
Copy link

raghnysh commented Oct 27, 2018

I am unable to validate documents with NVDL. I am working with XML Calabash 1.1.22-98, and DocBook 5.1. This is the pipeline nvdl.xpl that I am using:

<?xml version="1.0" encoding="utf-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:pxp="http://exproc.org/proposed/steps"
                version="1.0">
  <p:input port="source" />
  <p:output port="result" />
  <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl" />

  <pxp:nvdl name="validate-nvdl">
    <p:input port="nvdl">
      <p:document href="/pkg/docbook/docbook.nvdl" />
    </p:input>
    <p:input port="schemas">
      <p:empty />
    </p:input>
  </pxp:nvdl>
</p:declare-step>

This is the test file test.xml that I am using:

<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook">
  <title>Test</title>
  <para>This document is valid with respect to the RNG schema.</para>
  <annotation>
    <annotation>
      <para>However, this annotation inside an annotation violates a
      Schematron rule.</para>
    </annotation>
  </annotation>
</section>

The command

java -cp /pkg/xmlcalabash/xmlcalabash-1.1.22-98.jar com.xmlcalabash.drivers.Main -i source=test.xml nvdl.xpl

produces the error

ERROR: SAX Exception
ERROR:     cause: no implementation available for schema language with namespace URI "http://purl.oclc.org/dsdl/schematron"
ERROR: SAX Exception
ERROR: Underlying exception: no implementation available for schema language with namespace URI "http://purl.oclc.org/dsdl/schematron"

I am able to validate the document using validate-with-relax-ng, and am getting the expected error using validate-with-schematron.

@raghnysh
Copy link
Author

The problem seems to be related to this thread on the Oxygen XML Forum. According to it, the version of jing current in 2010 did not support ISO Schematron validation. The version of jing packaged by my OS (Linux Mint 18.1) is able to validate the file properly:

$ jing /pkg/docbook/docbook.nvdl test.xml 
/home/raghu/xml-sandbox/xproc-nvdl/test.xml:5: error: assertion failed:
  annotation must not occur among the children or descendants of annotation

$ jing | grep -i 'version'
Jing version 20131210

The version in the XML Calabash lib directory is jing-20091111.jar. Is it possible to replace it with a more recent version?

@raghnysh
Copy link
Author

raghnysh commented Oct 28, 2018

Using jing built from its GitHub source works better:

$ java -cp /home/raghu/Downloads/jing-trang/build/jing.jar:/pkg/xmlcalabash/xmlcalabash-1.1.22-98.jar com.xmlcalabash.drivers.Main -i source=test.xml nvdl.xpl

Warning at char 3 in xsl:param/@select on line 459 column 43 
  SXWN9000: The parent axis starting at a document node will never select anything

error: assertion failed:
  annotation must not occur among the children or descendants of annotation
ERROR: err:XC0053:XC0053
ERROR: It is a dynamic error if the assert-valid option is true and the input document is not valid.

$ java -jar /home/raghu/Downloads/jing-trang/build/jing.jar | grep -i version
Jing version 20151127

I don't know what the SXWN9000 warning means. The response is as expected modulo that warning.

@ndw
Copy link
Owner

ndw commented Oct 28, 2018

Ok. Thanks for doing the research. I noticed just this week that a recent version of jing/trang don’t seem to be in any of the common repositories. I’ll see about bundling it with the next XML Calabash release.

@raghnysh
Copy link
Author

The one at https://github.com/relaxng/jing-trang has version 20151127 which seems recent enough for this problem.

@ndw
Copy link
Owner

ndw commented Oct 29, 2018

Yes, but it's not on a public Maven repo, for example.

@ndw
Copy link
Owner

ndw commented Dec 9, 2018

We now have Jing in Maven, so 1.1.23 should work. Please reopen if I'm mistaken.

@ndw ndw closed this as completed Dec 9, 2018
@raghnysh
Copy link
Author

Thank you very much. It works now, except for the SXWN9000 warning.

$ java -cp /pkg/xmlcalabash/xmlcalabash-1.1.23-98.jar com.xmlcalabash.drivers.Main -i source=test.xml nvdl.xpl
Warning at char 3 in xsl:param/@select on line 459 column 43 
  SXWN9000: The parent axis starting at a document node will never select anything
error: assertion failed:
  annotation must not occur among the children or descendants of annotation
ERROR: err:XC0053:XC0053
ERROR: It is a dynamic error if the assert-valid option is true and the input document is not valid.

I don't know where the warning is coming from.

@ndw ndw reopened this Dec 10, 2018
@raghnysh
Copy link
Author

Just in case it is relevant, according to w3c/epubcheck#859 (comment) the warning is coming from the jing-trang iso-schematron.xsl file. There is also a followup at w3c/epubcheck#910.

@ndw
Copy link
Owner

ndw commented Dec 10, 2018

In progress, relaxng/jing-trang#240

@raghnysh raghnysh closed this as completed Dec 2, 2019
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