292.6. 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 技术 介绍 Schematron 。在 PDF 中是一个不错的文档,供您在 Schematron 上开始。* Schematron 官方网站。这包括其他资源的链接