4

I'm writing a DocBook 5 document and would like to fully validate it against both the RELAXNG and Schematron schemas.

Here is what I've tried:

  • To my knowledge, xmllint from the libxml2 package won't handle RELAXNG schemas with embedded Schematron, and the standalone schematron schema (docbook.sch) won't successfully compile according to xmllint.
  • MSV seems to handle everything OK, but I'm not using the relames JAR (I'm using 2013.6.1), so I don't know for sure if it's doing the embedded Schematron or not.
  • JNVDL also seemed to work, although it gave me a validation error telling me that I was using an ID multiple times in my document when in fact I was only using it once.

How can I fully validate my DocBook 5 document against both the RELAXNG and Schematron schemas?

allquixotic
  • 34,882

1 Answers1

3

This is a little embarrassing that I didn't notice this sooner, but I figured something out. I still haven't found a validation method that will correctly handle a single RELAXNG schema with embedded Schematron, but I have found a way to correctly validate my DocBook 5 document.

It turns out that DocBook 5.0 doesn't use the ISO standard of Schematron, but instead uses Schematron 1.5. Because of that, my attempts at extracting and validating the Schematron rules using the ISO Schematron resources were failing. Using the XSL scripts and method described at http://www.topologi.com/resources/schtrn_xsd_paper.html#Processing (be sure to get the obsolete files RNG2Schtrn.xsl and XSD2Schtrn.xsl, which work with Schematron 1.5) was successful.

The gist is:

  1. Use an XSL file (RNG2Schtrn.xsl) to extract the Schematron 1.5 rules from the RELAXNG schema

  2. Use the Schematron 1.5 validation XSL files (schematron-basic.xsl found at http://xml.ascc.net/schematron/1.5/basic1-5/schematron-basic.html) to create a validation XSL file from the Schematron rules for the DocBook document.

  3. Process the DocBook document using the validation XSL created in step 2 and look for errors in the output.

  4. Use a tool that can handle RELAXNG schemas to validate the rest of the DocBook document.