【发布时间】:2012-05-10 05:13:47
【问题描述】:
我在验证与 Schematron 结合的 SXD 架构时遇到了困难。
按照guide 中描述的步骤,我在 XSD 文档中的 <xs:appinfo> 标记之间合并了 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 page 上列出的简单的基于 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
非常感谢您帮助找出导致此错误的原因。
【问题讨论】:
标签: xml validation xsd schematron