0

由于在 XSD 文件中实施数据结构比在 Schematron 中更容易且更简洁,而且我们已经有工作 XSD 文件来验证单个实体,因此我想将这些作为第一个验证阶段包含在我的 Schematron 中。

我找到了描述相反方式的教程(XSD 中嵌入的 Schematron 规则)。

我找到了元素<sch:include href="my.xsd">,但是当我验证(使用 oXygen)时,它似乎没有任何区别。

似乎我遗漏了一些非常明显的东西,因为这应该得到支持而没有问题,或者不应该吗?

4

1 回答 1

2

好吧,据我所知,没有将 XSD 包含在 Schematron 中的概念。但是由于您可以在 Schematron 中嵌入 XSLT,并且 XSLT 模式感知能够验证您的输入数据,因此您可以使用 xsl:import-schema:

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sqf="http://www.schematron-quickfix.com/validator/process">

    <xsl:import-schema schema-location="path/to/my.xsd"/>

    <!-- [your schematron rules] -->
</sch:schema>

在 oXygen 中,您需要为 Schematron 验证激活模式感知:

Preferences -> XML -> XML-Parser -> Schematron -> Use Saxon EE (schema-aware) for xslt2/xslt3 查询语言绑定。

于 2017-06-09T13:20:31.190 回答