Florian Thienel | e82b475 | 2012-03-19 21:08:44 +0100 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <s:schema xmlns:s="http://www.ascc.net/xml/schematron" |
| 3 | xmlns:db="http://docbook.org/ns/docbook"> |
| 4 | <s:ns prefix="db" uri="http://docbook.org/ns/docbook"/> |
| 5 | <s:pattern name="Glossary 'firstterm' type constraint"> |
| 6 | <s:rule context="db:firstterm[@linkend]"> |
| 7 | <s: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.</s:assert> |
| 8 | </s:rule> |
| 9 | </s:pattern> |
| 10 | <s:pattern name="Footnote reference type constraint"> |
| 11 | <s:rule context="db:footnoteref"> |
| 12 | <s: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.</s:assert> |
| 13 | </s:rule> |
| 14 | </s:pattern> |
| 15 | <s:pattern name="Glossary 'glossterm' type constraint"> |
| 16 | <s:rule context="db:glossterm[@linkend]"> |
| 17 | <s: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.</s:assert> |
| 18 | </s:rule> |
| 19 | </s:pattern> |
| 20 | <s:pattern name="Synopsis fragment type constraint"> |
| 21 | <s:rule context="db:synopfragmentref"> |
| 22 | <s: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.</s:assert> |
| 23 | </s:rule> |
| 24 | </s:pattern> |
| 25 | <s:pattern name="Glosssary 'see' type constraint"> |
| 26 | <s:rule context="db:glosssee[@otherterm]"> |
| 27 | <s: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.</s:assert> |
| 28 | </s:rule> |
| 29 | </s:pattern> |
| 30 | <s:pattern name="Glossary 'seealso' type constraint"> |
| 31 | <s:rule context="db:glossseealso[@otherterm]"> |
| 32 | <s: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.</s:assert> |
| 33 | </s:rule> |
| 34 | </s:pattern> |
| 35 | <s:pattern name="Glossary term definition constraint"> |
| 36 | <s:rule context="db:termdef"> |
| 37 | <s:assert test="count(db:firstterm) = 1">A termdef must contain exactly one firstterm</s:assert> |
| 38 | </s:rule> |
| 39 | </s:pattern> |
| 40 | <s:pattern name="Cardinality of segments and titles"> |
| 41 | <s:rule context="db:seglistitem"> |
| 42 | <s: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</s:assert> |
| 43 | </s:rule> |
| 44 | </s:pattern> |
| 45 | <s:pattern name="Root must have version"> |
| 46 | <s:rule context="/db:para"> |
| 47 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 48 | </s:rule> |
| 49 | <s:rule context="/db:set"> |
| 50 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 51 | </s:rule> |
| 52 | <s:rule context="/db:book"> |
| 53 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 54 | </s:rule> |
| 55 | <s:rule context="/db:dedication"> |
| 56 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 57 | </s:rule> |
| 58 | <s:rule context="/db:acknowledgements"> |
| 59 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 60 | </s:rule> |
| 61 | <s:rule context="/db:colophon"> |
| 62 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 63 | </s:rule> |
| 64 | <s:rule context="/db:appendix"> |
| 65 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 66 | </s:rule> |
| 67 | <s:rule context="/db:chapter"> |
| 68 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 69 | </s:rule> |
| 70 | <s:rule context="/db:part"> |
| 71 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 72 | </s:rule> |
| 73 | <s:rule context="/db:preface"> |
| 74 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 75 | </s:rule> |
| 76 | <s:rule context="/db:section"> |
| 77 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 78 | </s:rule> |
| 79 | <s:rule context="/db:article"> |
| 80 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 81 | </s:rule> |
| 82 | <s:rule context="/db:sect1"> |
| 83 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 84 | </s:rule> |
| 85 | <s:rule context="/db:sect2"> |
| 86 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 87 | </s:rule> |
| 88 | <s:rule context="/db:sect3"> |
| 89 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 90 | </s:rule> |
| 91 | <s:rule context="/db:sect4"> |
| 92 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 93 | </s:rule> |
| 94 | <s:rule context="/db:sect5"> |
| 95 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 96 | </s:rule> |
| 97 | <s:rule context="/db:reference"> |
| 98 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 99 | </s:rule> |
| 100 | <s:rule context="/db:refentry"> |
| 101 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 102 | </s:rule> |
| 103 | <s:rule context="/db:refsection"> |
| 104 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 105 | </s:rule> |
| 106 | <s:rule context="/db:refsect1"> |
| 107 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 108 | </s:rule> |
| 109 | <s:rule context="/db:refsect2"> |
| 110 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 111 | </s:rule> |
| 112 | <s:rule context="/db:refsect3"> |
| 113 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 114 | </s:rule> |
| 115 | <s:rule context="/db:glossary"> |
| 116 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 117 | </s:rule> |
| 118 | <s:rule context="/db:bibliography"> |
| 119 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 120 | </s:rule> |
| 121 | <s:rule context="/db:index"> |
| 122 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 123 | </s:rule> |
| 124 | <s:rule context="/db:setindex"> |
| 125 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 126 | </s:rule> |
| 127 | <s:rule context="/db:toc"> |
| 128 | <s:assert test="@version">The root element must have a version attribute.</s:assert> |
| 129 | </s:rule> |
| 130 | </s:pattern> |
| 131 | <s:pattern name="Element exclusion"> |
| 132 | <s:rule context="db:annotation"> |
| 133 | <s:assert test="not(.//db:annotation)">annotation must not occur in the descendants of annotation</s:assert> |
| 134 | </s:rule> |
| 135 | <s:rule context="db:caution"> |
| 136 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of caution</s:assert> |
| 137 | <s:assert test="not(.//db:important)">important must not occur in the descendants of caution</s:assert> |
| 138 | <s:assert test="not(.//db:note)">note must not occur in the descendants of caution</s:assert> |
| 139 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of caution</s:assert> |
| 140 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of caution</s:assert> |
| 141 | </s:rule> |
| 142 | <s:rule context="db:important"> |
| 143 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of important</s:assert> |
| 144 | <s:assert test="not(.//db:important)">important must not occur in the descendants of important</s:assert> |
| 145 | <s:assert test="not(.//db:note)">note must not occur in the descendants of important</s:assert> |
| 146 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of important</s:assert> |
| 147 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of important</s:assert> |
| 148 | </s:rule> |
| 149 | <s:rule context="db:note"> |
| 150 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of note</s:assert> |
| 151 | <s:assert test="not(.//db:important)">important must not occur in the descendants of note</s:assert> |
| 152 | <s:assert test="not(.//db:note)">note must not occur in the descendants of note</s:assert> |
| 153 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of note</s:assert> |
| 154 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of note</s:assert> |
| 155 | </s:rule> |
| 156 | <s:rule context="db:tip"> |
| 157 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of tip</s:assert> |
| 158 | <s:assert test="not(.//db:important)">important must not occur in the descendants of tip</s:assert> |
| 159 | <s:assert test="not(.//db:note)">note must not occur in the descendants of tip</s:assert> |
| 160 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of tip</s:assert> |
| 161 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of tip</s:assert> |
| 162 | </s:rule> |
| 163 | <s:rule context="db:warning"> |
| 164 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of warning</s:assert> |
| 165 | <s:assert test="not(.//db:important)">important must not occur in the descendants of warning</s:assert> |
| 166 | <s:assert test="not(.//db:note)">note must not occur in the descendants of warning</s:assert> |
| 167 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of warning</s:assert> |
| 168 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of warning</s:assert> |
| 169 | </s:rule> |
| 170 | <s:rule context="db:caption"> |
| 171 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of caption</s:assert> |
| 172 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of caption</s:assert> |
| 173 | <s:assert test="not(.//db:example)">example must not occur in the descendants of caption</s:assert> |
| 174 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of caption</s:assert> |
| 175 | <s:assert test="not(.//db:important)">important must not occur in the descendants of caption</s:assert> |
| 176 | <s:assert test="not(.//db:note)">note must not occur in the descendants of caption</s:assert> |
| 177 | <s:assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of caption</s:assert> |
| 178 | <s:assert test="not(.//db:table)">table must not occur in the descendants of caption</s:assert> |
| 179 | <s:assert test="not(.//db:task)">task must not occur in the descendants of caption</s:assert> |
| 180 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of caption</s:assert> |
| 181 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of caption</s:assert> |
| 182 | </s:rule> |
| 183 | <s:rule context="db:equation"> |
| 184 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of equation</s:assert> |
| 185 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of equation</s:assert> |
| 186 | <s:assert test="not(.//db:example)">example must not occur in the descendants of equation</s:assert> |
| 187 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of equation</s:assert> |
| 188 | <s:assert test="not(.//db:important)">important must not occur in the descendants of equation</s:assert> |
| 189 | <s:assert test="not(.//db:note)">note must not occur in the descendants of equation</s:assert> |
| 190 | <s:assert test="not(.//db:table)">table must not occur in the descendants of equation</s:assert> |
| 191 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of equation</s:assert> |
| 192 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of equation</s:assert> |
| 193 | </s:rule> |
| 194 | <s:rule context="db:example"> |
| 195 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of example</s:assert> |
| 196 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of example</s:assert> |
| 197 | <s:assert test="not(.//db:example)">example must not occur in the descendants of example</s:assert> |
| 198 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of example</s:assert> |
| 199 | <s:assert test="not(.//db:important)">important must not occur in the descendants of example</s:assert> |
| 200 | <s:assert test="not(.//db:note)">note must not occur in the descendants of example</s:assert> |
| 201 | <s:assert test="not(.//db:table)">table must not occur in the descendants of example</s:assert> |
| 202 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of example</s:assert> |
| 203 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of example</s:assert> |
| 204 | </s:rule> |
| 205 | <s:rule context="db:figure"> |
| 206 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of figure</s:assert> |
| 207 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of figure</s:assert> |
| 208 | <s:assert test="not(.//db:example)">example must not occur in the descendants of figure</s:assert> |
| 209 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of figure</s:assert> |
| 210 | <s:assert test="not(.//db:important)">important must not occur in the descendants of figure</s:assert> |
| 211 | <s:assert test="not(.//db:note)">note must not occur in the descendants of figure</s:assert> |
| 212 | <s:assert test="not(.//db:table)">table must not occur in the descendants of figure</s:assert> |
| 213 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of figure</s:assert> |
| 214 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of figure</s:assert> |
| 215 | </s:rule> |
| 216 | <s:rule context="db:table"> |
| 217 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of table</s:assert> |
| 218 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of table</s:assert> |
| 219 | <s:assert test="not(.//db:example)">example must not occur in the descendants of table</s:assert> |
| 220 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of table</s:assert> |
| 221 | <s:assert test="not(.//db:important)">important must not occur in the descendants of table</s:assert> |
| 222 | <s:assert test="not(.//db:informaltable)">informaltable must not occur in the descendants of table</s:assert> |
| 223 | <s:assert test="not(.//db:note)">note must not occur in the descendants of table</s:assert> |
| 224 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of table</s:assert> |
| 225 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of table</s:assert> |
| 226 | </s:rule> |
| 227 | <s:rule context="db:footnote"> |
| 228 | <s:assert test="not(.//db:caution)">caution must not occur in the descendants of footnote</s:assert> |
| 229 | <s:assert test="not(.//db:epigraph)">epigraph must not occur in the descendants of footnote</s:assert> |
| 230 | <s:assert test="not(.//db:equation)">equation must not occur in the descendants of footnote</s:assert> |
| 231 | <s:assert test="not(.//db:example)">example must not occur in the descendants of footnote</s:assert> |
| 232 | <s:assert test="not(.//db:figure)">figure must not occur in the descendants of footnote</s:assert> |
| 233 | <s:assert test="not(.//db:footnote)">footnote must not occur in the descendants of footnote</s:assert> |
| 234 | <s:assert test="not(.//db:important)">important must not occur in the descendants of footnote</s:assert> |
| 235 | <s:assert test="not(.//db:indexterm)">indexterm must not occur in the descendants of footnote</s:assert> |
| 236 | <s:assert test="not(.//db:note)">note must not occur in the descendants of footnote</s:assert> |
| 237 | <s:assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of footnote</s:assert> |
| 238 | <s:assert test="not(.//db:table)">table must not occur in the descendants of footnote</s:assert> |
| 239 | <s:assert test="not(.//db:task)">task must not occur in the descendants of footnote</s:assert> |
| 240 | <s:assert test="not(.//db:tip)">tip must not occur in the descendants of footnote</s:assert> |
| 241 | <s:assert test="not(.//db:warning)">warning must not occur in the descendants of footnote</s:assert> |
| 242 | </s:rule> |
| 243 | <s:rule context="db:sidebar"> |
| 244 | <s:assert test="not(.//db:sidebar)">sidebar must not occur in the descendants of sidebar</s:assert> |
| 245 | </s:rule> |
| 246 | </s:pattern> |
| 247 | </s:schema> |