-
Notifications
You must be signed in to change notification settings - Fork 5
/
html4tei.sch.xml
50 lines (45 loc) · 2.25 KB
/
html4tei.sch.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0" encoding="utf-8"?>
<s:schema
xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
queryBinding="xslt2"
defaultPhase="#ALL">
<s:ns prefix="html" uri="http://www.w3.org/1999/xhtml"/>
<s:pattern id="headings">
<s:rule context="*:div[@id = 'sxedit-main']/*[not(self::*:parsererror)][1]">
<s:assert test="matches(local-name(), '^h\d')"
id="first-para-must-be-heading" role="error">The first paragraph must be a heading. Currently: <s:value-of select="name()"/></s:assert>
</s:rule>
</s:pattern>
<s:pattern id="skipped-headings">
<s:rule context="*[matches(local-name(), '^h\d')]">
<s:let name="current-level" value="number(substring(local-name(), 2, 1))"/>
<s:let name="next-heading" value="following-sibling::*[matches(local-name(.), '^h\d')][1]"/>
<s:let name="next-level" value="if (exists($next-heading))
then number(substring(local-name($next-heading), 2, 1))
else $current-level"/>
<s:assert test="$next-level le $current-level + 1" id="skipped-heading" role="error">You skipped
h<s:value-of select="$current-level + 1"/> after this heading.</s:assert>
</s:rule>
</s:pattern>
<s:pattern id="namespace">
<s:rule context="*">
<s:assert test="namespace-uri() = ('http://www.w3.org/1999/xhtml', '')"
id="HTML-elements-only" role="error">Each element must be either in the XHTML namespace or in no namespace.
Found: <s:value-of select="namespace-uri()"/></s:assert>
</s:rule>
</s:pattern>
<s:pattern id="captions">
<s:rule context="*:caption">
<s:assert test="every $c in * satisfies (local-name($c) = ('p', 'dl', 'ol', 'ul'))"
id="only-paras-in-captions" role="error">
Captions may only contain paras or lists. Found: <s:value-of select="*/local-name()"/>
</s:assert>
<s:assert test="count(* | text()[matches(., '\S')]) eq 1"
id="exactly-one-caption-element" role="error">
A caption must contain exactly one element (paragraph or list). Found: <s:value-of select="*/local-name()"/>
</s:assert>
</s:rule>
</s:pattern>
</s:schema>