- Add a Schematron namespace declaration
- Stock DocBook schematron constaints use different Schematron namespace so copy-paste them here because they cannot be processed with the ISO Schematron stylesheets
This commit is contained in:
parent
194644ff8a
commit
6ab2cc267d
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/projects/db5/; revision=41994
1 changed files with 248 additions and 0 deletions
|
@ -5,6 +5,9 @@
|
|||
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
|
||||
xmlns:db="http://docbook.org/ns/docbook"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<ns prefix="db" uri="http://docbook.org/ns/docbook"/>
|
||||
|
||||
<pattern name="Check file reference validity">
|
||||
<rule context="//db:imagedata|//db:graphic">
|
||||
<report test="contains(@fileref, '.')">Image reference (<xsl:value-of select="@fileref"/>) cannot have an extension; the proper format is inferred by the output type to generate.</report>
|
||||
|
@ -40,4 +43,249 @@
|
|||
<assert test="(. = 'freebsd8') or (. = 'freebsd9') or (. = 'freebsd10')">Invalid os value (<xsl:value-of select="."/>); must be either 'freebsd8', 'freebsd9' or 'freebsd10'.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
|
||||
<!-- DB 5.0 constraints -->
|
||||
|
||||
<pattern name="Glossary 'firstterm' type constraint">
|
||||
<rule context="db:firstterm[@linkend]">
|
||||
<assert test="local-name(//*[@xml:id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@xml:id=current()/@linkend]) = 'http://docbook.org/ns/docbook'">@linkend on firstterm must point to a glossentry.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Footnote reference type constraint">
|
||||
<rule context="db:footnoteref">
|
||||
<assert test="local-name(//*[@xml:id=current()/@linkend]) = 'footnote' and namespace-uri(//*[@xml:id=current()/@linkend]) = 'http://docbook.org/ns/docbook'">@linkend on footnoteref must point to a footnote.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Glossary 'glossterm' type constraint">
|
||||
<rule context="db:glossterm[@linkend]">
|
||||
<assert test="local-name(//*[@xml:id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@xml:id=current()/@linkend]) = 'http://docbook.org/ns/docbook'">@linkend on glossterm must point to a glossentry.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Synopsis fragment type constraint">
|
||||
<rule context="db:synopfragmentref">
|
||||
<assert test="local-name(//*[@xml:id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@xml:id=current()/@linkend]) = 'http://docbook.org/ns/docbook'">@linkend on synopfragmentref must point to a synopfragment.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Glosssary 'see' type constraint">
|
||||
<rule context="db:glosssee[@otherterm]">
|
||||
<assert test="local-name(//*[@xml:id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@xml:id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'">@otherterm on glosssee must point to a glossentry.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Glossary 'seealso' type constraint">
|
||||
<rule context="db:glossseealso[@otherterm]">
|
||||
<assert test="local-name(//*[@xml:id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@xml:id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'">@otherterm on glossseealso must point to a glossentry.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Glossary term definition constraint">
|
||||
<rule context="db:termdef">
|
||||
<assert test="count(db:firstterm) = 1">A termdef must contain exactly one firstterm</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Cardinality of segments and titles">
|
||||
<rule context="db:seglistitem">
|
||||
<assert test="count(db:seg) = count(../db:segtitle)">The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Root must have version">
|
||||
<rule context="/db:para">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:set">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:book">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:dedication">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:acknowledgements">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:colophon">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:appendix">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:chapter">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:part">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:preface">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:section">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:article">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:sect1">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:sect2">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:sect3">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:sect4">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:sect5">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:reference">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:refentry">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:refsection">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:refsect1">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:refsect2">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:refsect3">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:glossary">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:bibliography">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:index">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:setindex">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
<rule context="/db:toc">
|
||||
<assert test="@version">The root element must have a version attribute.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
<pattern name="Element exclusion">
|
||||
<rule context="db:annotation">
|
||||
<assert test="not(.//db:annotation)">annotation must not occur in the descendants of annotation</assert>
|
||||
</rule>
|
||||
<rule context="db:caution">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of caution</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of caution</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of caution</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of caution</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of caution</assert>
|
||||
</rule>
|
||||
<rule context="db:important">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of important</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of important</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of important</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of important</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of important</assert>
|
||||
</rule>
|
||||
<rule context="db:note">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of note</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of note</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of note</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of note</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of note</assert>
|
||||
</rule>
|
||||
<rule context="db:tip">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of tip</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of tip</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of tip</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of tip</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of tip</assert>
|
||||
</rule>
|
||||
<rule context="db:warning">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of warning</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of warning</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of warning</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of warning</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of warning</assert>
|
||||
</rule>
|
||||
<rule context="db:caption">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:table)">table must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:task)">task must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of caption</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of caption</assert>
|
||||
</rule>
|
||||
<rule context="db:equation">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:table)">table must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of equation</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of equation</assert>
|
||||
</rule>
|
||||
<rule context="db:example">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:table)">table must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of example</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of example</assert>
|
||||
</rule>
|
||||
<rule context="db:figure">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:table)">table must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of figure</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of figure</assert>
|
||||
</rule>
|
||||
<rule context="db:table">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:informaltable)">informaltable must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of table</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of table</assert>
|
||||
</rule>
|
||||
<rule context="db:footnote">
|
||||
<assert test="not(.//db:caution)">caution must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:epigraph)">epigraph must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:equation)">equation must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:example)">example must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:figure)">figure must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:footnote)">footnote must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:important)">important must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:indexterm)">indexterm must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:note)">note must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:table)">table must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:task)">task must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:tip)">tip must not occur in the descendants of footnote</assert>
|
||||
<assert test="not(.//db:warning)">warning must not occur in the descendants of footnote</assert>
|
||||
</rule>
|
||||
<rule context="db:sidebar">
|
||||
<assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of sidebar</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
|
Loading…
Reference in a new issue