Schematron sh脚本未运行



我为Schematron找到了一个shell脚本,您应该能够提供Schematron模式和XML文档,以便将Schematron规则应用于XML文档。我在这里找到了脚本:

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

脚本使用的各种xsl文件可从Schematron发行版下载,如下所示:

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

为了方便起见,我将在这里重复shell脚本。

#!/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 

我这样运行脚本:

run_schematron.sh docbook1.sch my_xml.xml

shell脚本生成中间文件step1.xsl、step2.xsl和step3.xsl

<?xml version="1.0"?>
        @linkend on footnoteref must point to a footnote.
         @linkend on synopfragmentref must point to a synopfragment.

我觉得这不像XSL样式表。有什么想法吗?

问题是您将docbook.sh用于docbook 5.0,它不是ISO Schematron架构(绑定到s:前缀的命名空间不是http://purl.oclc.org/dsdl/schematron)。

在docbook 5.0的docbook.sh中,只需更改以下内容:

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

到此:

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

它会起作用的。

在docbook 5.1的docbook.sh(尚未正式发布)中,名称空间已经更改。

最新更新