Schematronと組み合わせたSXDスキーマの検証に問題があります。Schematronとxsltprocを使用してXSDスキーマを検証する
<?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"/>
次のように私はXSD文書の
<xs:appinfo>
タグの間のSchematronを取り入れてきました。この
guideで説明する手順に従い
シンプルなxsltprocベースのスクリプトを使用して、schematron pageにリストされています。残念ながら、スクリプトの最後のステップで次のエラーメッセージが表示されます。
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
このエラーの原因を理解していただきありがとうございます。
ありがとうございました。できます。しかし、あなたはまだXSD2がちょうど標準化されているという事実を考慮して、Schematronの使用を主張していますか? – Olumide
あなたはXML Schema 1.1を意味しますか?) Schematronは、使用できるXPath式に制限を課すXML SChema 1.1アサーションよりもはるかに柔軟性があり、エラーメッセージを定義するためにSchematron独自の機能を保持します。私の助言は、あなたのニーズを満たすときにXSD 1.1を使用することですが、必要に応じてSchematronを使用することができます。 –