1

我为 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。但是我已经在 step2.xsl 中偏离了轨道,因为它看起来像这样:

<?xml version="1.0"?>

        @linkend on footnoteref must point to a footnote.

         @linkend on synopfragmentref must point to a synopfragment.

对我来说,这看起来不像 XSL 样式表。有任何想法吗?

4

1 回答 1

1

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

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

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

对此:

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

...它会工作。

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

于 2013-07-24T12:56:46.113 回答