xmlshellxslt-1.0schematrondocbook-5

Schematron sh script not behaving


I found a shell script for Schematron that your supposed to be able to feed a Schematron schema, and an XML document, so as to apply the Schematron rules to the XML document. I found the script here:

https://code.google.com/p/schematron/wiki/RunningSchematronWithGNOMExsltproc

The various xsl files used by the script are downloaded from the Schematron distribution here:

http://www.schematron.com/implementation.html

I'll repeat the shell script here, for convenience.

#!/bin/bash

echo Step1 ...
xsltproc iso_dsdl_include.xsl $1 > step1.xsl

echo Step2 ...
xsltproc iso_abstract_expand.xsl step1.xsl > step2.xsl

echo Step3 ...
xsltproc iso_svrl_for_xslt1.xsl step2.xsl > step3.xsl

echo Validation ...
xsltproc step3.xsl $2 > result.svrl 

I run the script like this:

run_schematron.sh docbook1.sch my_xml.xml

The shell script generates intermediate files, step1.xsl, step2.xsl, and step3.xsl. But I am already off the rails at step2.xsl, since it looks like this:

<?xml version="1.0"?>

        @linkend on footnoteref must point to a footnote.

         @linkend on synopfragmentref must point to a synopfragment.

That's not looking like an XSL stylesheet to me. Any ideas?


Solution

  • The problem is that you are using docbook.sch for DocBook 5.0, which is not an ISO Schematron schema (the namespace bound to the s: prefix is not http://purl.oclc.org/dsdl/schematron).

    In docbook.sch for DocBook 5.0, simply change this:

    xmlns:s="http://www.ascc.net/xml/schematron"
    

    to this:

    xmlns:s="http://purl.oclc.org/dsdl/schematron"
    

    ...and it will work.

    In docbook.sch for DocBook 5.1 (which hasn't been offically released yet), the namespace has been changed.