我在验证与 Schematron 结合的 SXD 模式时遇到了困难。
按照本指南中描述的步骤,我<xs:appinfo>
在 XSD 文档中的标记之间合并了 schematron,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Test">
<xs:annotation>
<xs:appinfo>
<sch:pattern name="Testing schematron" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<sch:rule context="Test">
<sch:assert test="@Attribute1">Attribute 1 exists</sch:assert>
</sch:rule>
</sch:pattern>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attribute name="Attribute1" type="xs:string" use="optional"/>
<xs:attribute name="Attribute2" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:schema>
该文档应该测试(或验证)该文档
<?xml version="1.0" encoding="ISO-8859-1"?>
<Test Attribute1="attr1"/>
使用 schematron页面上列出的简单的基于 xsltproc 的脚本。不幸的是,我在脚本的最后一步收到以下错误消息。
step3.xsl:13: parser error : Extra content at the end of the document
plates select="*|comment()|processing-instruction()" mode="M0"/></axsl:template>
^
cannot parse step3.xsl
我很感激帮助找出这个错误的原因。