Schematron
<chapter id="introduction" ❶> ... <section xml:id="firstSection" ❶> <title>First section</title> <para>A stable link</para> </section> <section> <!-- no xml:id attribute--> <title>Second section</title> <para>No stable link</para> ... |
<!-- file introduction.html --> <html> ... <h2 id="firstSection" ❶>First section</h2> <p>A stable link</p> <h2 id="d03213" ❷>Second section</h2> <p>No stable link</p> |

❶ |
The page's URI based on |
❷ |
Stable
|
❸ |
Unstable
|
- Requirement
-
Important elements (
<chapter>
,<section>
,<table>
...) must provide an xml:id value. - Implementation choices
-
-
Modify underlying RelaxNG schema.
Result: Restricted schema (Inheritance relationship)
-
Add Schematron integrity rule on top of schema.
-
<s:pattern>
<s:title>Mandatory Id definition constraint</s:title>
<s:rule context="db:chapter|db:section|db:table|db:qandaset">
<s:assert test="@xml:id"
>Each chapter,section, table ... must have a unique id.</s:assert>
</s:rule>
</s:pattern>