272.5. Schematron ルールとレポートのサンプル
Schematron ルールの例を次に示します。
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<title>Check Sections 12/07</title>
<pattern id="section-check">
<rule context="section">
<assert test="title">This section has no title</assert>
<assert test="para">This section has no paragraphs</assert>
</rule>
</pattern>
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<title>Check Sections 12/07</title>
<pattern id="section-check">
<rule context="section">
<assert test="title">This section has no title</assert>
<assert test="para">This section has no paragraphs</assert>
</rule>
</pattern>
</schema>
Schematron レポートの例を次に示します。
<?xml version="1.0" encoding="UTF-8"?>
<svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:saxon="http://saxon.sf.net/"
xmlns:schold="http://www.ascc.net/xml/schematron"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" schemaVersion="" title="">
<svrl:active-pattern document="" />
<svrl:fired-rule context="chapter" />
<svrl:failed-assert test="title" location="/doc[1]/chapter[1]">
<svrl:text>A chapter should have a title</svrl:text>
</svrl:failed-assert>
<svrl:fired-rule context="chapter" />
<svrl:failed-assert test="title" location="/doc[1]/chapter[2]">
<svrl:text>A chapter should have a title</svrl:text>
</svrl:failed-assert>
<svrl:fired-rule context="chapter" />
</svrl:schematron-output>
<?xml version="1.0" encoding="UTF-8"?>
<svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:saxon="http://saxon.sf.net/"
xmlns:schold="http://www.ascc.net/xml/schematron"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" schemaVersion="" title="">
<svrl:active-pattern document="" />
<svrl:fired-rule context="chapter" />
<svrl:failed-assert test="title" location="/doc[1]/chapter[1]">
<svrl:text>A chapter should have a title</svrl:text>
</svrl:failed-assert>
<svrl:fired-rule context="chapter" />
<svrl:failed-assert test="title" location="/doc[1]/chapter[2]">
<svrl:text>A chapter should have a title</svrl:text>
</svrl:failed-assert>
<svrl:fired-rule context="chapter" />
</svrl:schematron-output>
ヒント
便利なリンクとリソース * Mulleberry technologies による Schematron の紹介。Schematron の使用を開始するための優れた PDF ドキュメントです。スキーマトロン公式サイト。これには、他のリソースへのリンクが含まれています