Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Schematron with Perl
    primarykey
    data
    text
    <p>I am trying to follow along with this article on Schematron and Perl. </p> <p><a href="http://www.xml.com/pub/a/2002/01/23/perl-schematron.html?page=2" rel="nofollow">http://www.xml.com/pub/a/2002/01/23/perl-schematron.html?page=2</a></p> <p>My goal is to use Schematron, along with RelaxNG, to validate Docbook 5 documents.</p> <p>However, I can't seem to get this basic example to work. Here's my Perl script, copied from the O'Reilly article:</p> <pre><code>#!/usr/bin/perl -w use strict; use XML::Schematron::LibXSLT; my $schema_file = $ARGV[0]; my $xml_file = $ARGV[1]; die "Usage: perl schematron.pl schemafile XMLfile.\n" unless defined $schema_file and defined $xml_file; my $tron = XML::Schematron::LibXSLT-&gt;new(); $tron-&gt;schema($schema_file); my $ret = $tron-&gt;verify($xml_file); print $ret . "\n"; </code></pre> <p>I call the script like this:</p> <p>perl schematron.pl path-to-docbook.sch path-to-xml-file</p> <p>I get back errors having to do with the namespace "db":</p> <pre><code>xsltCompileStepPattern : no namespace bound to prefix db compilation error: file unknown-101d82900 element template xsltCompilePattern : failed to compile 'db:sidebar' error ... </code></pre> <p>My docbook.sch file begins as follows. It is the docbook.sch schema file that comes with the Docbook 5 distribution:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:schema xmlns:s="http://www.ascc.net/xml/schematron" xmlns:db="http://docbook.org/ns/docbook"&gt; &lt;s:ns prefix="db" uri="http://docbook.org/ns/docbook"/&gt; &lt;s:pattern name="Element exclusion"&gt; &lt;s:rule context="db:sidebar"&gt; </code></pre> <p>Could it be that the Perl module uses a version of Schematron that doesn't understand namespaces? Or could it be that docbook.sch is incorrect? That would be strange, since it comes with the Docbook distribution.</p> <p>I may be missing something fundamental, because I'm new to Schematron.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload