我正在尝试遵循这篇关于Schematron和Perl的文章。在Schematron和Perl上使用Schematron
http://www.xml.com/pub/a/2002/01/23/perl-schematron.html?page=2
我的目标是使用Schematron的,与RelaxNG一起,来验证的Docbook 5号文件。
但是,我似乎无法得到这个基本的例子工作。这里是我的Perl脚本,由O'Reilly的文章复制:
#!/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->new();
$tron->schema($schema_file);
my $ret = $tron->verify($xml_file);
print $ret . "\n";
我所说的脚本是这样的:
perl的schematron.pl路径到docbook.sch路径到XML文件
我回到具有与该命名空间“分贝”做错误:
xsltCompileStepPattern : no namespace bound to prefix db
compilation error: file unknown-101d82900 element template
xsltCompilePattern : failed to compile 'db:sidebar'
error
...
我docbook.sch文件开始,如下所示。它是自带的Docbook 5分布docbook.sch模式文件:
<?xml version="1.0" encoding="utf-8"?>
<s:schema xmlns:s="http://www.ascc.net/xml/schematron" xmlns:db="http://docbook.org/ns/docbook">
<s:ns prefix="db" uri="http://docbook.org/ns/docbook"/>
<s:pattern name="Element exclusion">
<s:rule context="db:sidebar">
难道是Perl的模块使用一个版本的Schematron的不理解命名空间?或者它可能是docbook.sch不正确?这很奇怪,因为它附带了Docbook发行版。
我可能缺少一些基本的东西,因为我是Schematron的新手。