我正在嘗試遵循這篇關於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的新手。