|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 |
| -<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" |
3 |
| - xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xs="http://www.w3.org/2001/XMLSchema-datatypes" > |
4 |
| - <sch:pattern > |
5 |
| - <sch:rule context="input[@type='location'][@units eq 'tilematrix'][@axis eq 'row' or @axis eq 'column']"> |
| 2 | +<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" |
| 3 | + xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xs="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | + <sch:ns uri="http://www.w3.org/1999/xhtml" prefix="h"/> |
| 5 | + <sch:pattern > |
| 6 | + <sch:rule context="h:input[@type='location'][@units eq 'tilematrix'][@axis eq 'row' or @axis eq 'column']"> |
6 | 7 | <sch:assert test="./@rel eq 'map' or not(./@rel)">For inputs[@type=location], @rel must equal 'map' or not exist</sch:assert>
|
7 | 8 | </sch:rule>
|
8 |
| - <sch:rule context="input[@type='location'][@units eq 'map']"> |
| 9 | + <sch:rule context="h:input[@type='location'][@units eq 'map']"> |
9 | 10 | <sch:assert test="./@axis eq 'j' or ./@axis eq 'i'">For inputs[@type=location][units=map] @axis must exist and be equal to either i or j</sch:assert>
|
10 | 11 | </sch:rule>
|
11 |
| - <sch:rule context="input[@type='location'][@axis eq 'easting']"> |
12 |
| - <sch:assert test="exists(preceding-sibling::input[@axis eq 'northing']) or exists(following-sibling::input[@axis eq 'northing'])">Easting axis reference must have paired northing axis reference</sch:assert> |
| 12 | + <sch:rule context="h:input[@type='location'][@axis eq 'easting']"> |
| 13 | + <sch:assert test="exists(preceding-sibling::h:input[@axis eq 'northing']) or exists(following-sibling::h:input[@axis eq 'northing'])">Easting axis reference must have paired northing axis reference</sch:assert> |
13 | 14 | </sch:rule>
|
14 |
| - <sch:rule context="input[@type='location'][@axis eq 'northing']"> |
15 |
| - <sch:assert test="exists(preceding-sibling::input[@axis eq 'easting']) or exists(following-sibling::input[@axis eq 'easting'])">Northing axis reference must have paired easting axis reference</sch:assert> |
| 15 | + <sch:rule context="h:input[@type='location'][@axis eq 'northing']"> |
| 16 | + <sch:assert test="exists(preceding-sibling::h:input[@axis eq 'easting']) or exists(following-sibling::h:input[@axis eq 'easting'])">Northing axis reference must have paired easting axis reference</sch:assert> |
16 | 17 | </sch:rule>
|
17 |
| - <sch:rule context="input[@type='hidden'][@shard]"> |
| 18 | + <sch:rule context="h:input[@type='hidden'][@shard]"> |
18 | 19 | <sch:assert test="exists(./@list)">A shard-type input must have a @list attribute</sch:assert>
|
19 | 20 | <sch:let name="listid" value="./@list"></sch:let>
|
20 |
| - <sch:assert test="exists(//datalist[@id eq $listid])">A datalist must be associated to a shard-type input</sch:assert> |
| 21 | + <sch:assert test="exists(//h:datalist[@id eq $listid])">A datalist must be associated to a shard-type input</sch:assert> |
21 | 22 | <sch:report test="exists(./@value)">A shard-type input must not have a @value</sch:report>
|
22 | 23 | </sch:rule>
|
23 |
| - <sch:rule context="input[@shard]"> |
| 24 | + <sch:rule context="h:input[@shard]"> |
24 | 25 | <sch:assert test=".[@type eq 'hidden']">A shard-type input must have @type="hidden"</sch:assert>
|
25 | 26 | </sch:rule>
|
26 |
| - <sch:rule context="extent"> |
27 |
| - <sch:assert test="input[@type eq 'zoom']">Extent must have a zoom input</sch:assert> |
28 |
| - <sch:assert test="(count((input[@type='location'][@axis eq 'i'] union input[@type='location'][@axis eq 'j'])) mod 2) eq 0">location inputs with axis=i or j must come in pairs</sch:assert> |
29 |
| - <sch:assert test="(count(input[@type='location'][@axis eq 'easting' or @axis eq 'northing']) mod 2) eq 0">location inputs with axis=easting or northing must come in pairs</sch:assert> |
30 |
| - <sch:assert test="(count(input[@type='location'][@axis eq 'latitude' or @axis eq 'longitude']) mod 2) eq 0">location inputs with axis=latitude or longitude must come in pairs</sch:assert> |
31 |
| - <sch:assert test="(count(input[@type='location'][@axis eq 'row' or @axis eq 'column']) mod 2) eq 0">location inputs with axis=row or column must come in pairs</sch:assert> |
32 |
| - <sch:assert test="(count(input[@type='location'][@axis eq 'x' or @axis eq 'y']) mod 2) eq 0">location inputs with axis=x or y must come in pairs</sch:assert> |
33 |
| - <sch:report test="(exists(@method) and not(exists(@action)))">An extent with a method attribute must have an action attribute</sch:report> |
| 27 | + <sch:rule context="h:extent"> |
| 28 | + <sch:assert test="h:input[@type eq 'zoom']">Extent must have a zoom input</sch:assert> |
| 29 | + <sch:assert test="(count((h:input[@type='location'][@axis eq 'i'] union h:input[@type='location'][@axis eq 'j'])) mod 2) eq 0">location inputs with axis=i or j must come in pairs</sch:assert> |
| 30 | + <sch:assert test="(count(h:input[@type='location'][@axis eq 'easting' or @axis eq 'northing']) mod 2) eq 0">location inputs with axis=easting or northing must come in pairs</sch:assert> |
| 31 | + <sch:assert test="(count(h:input[@type='location'][@axis eq 'latitude' or @axis eq 'longitude']) mod 2) eq 0">location inputs with axis=latitude or longitude must come in pairs</sch:assert> |
| 32 | + <sch:assert test="(count(h:input[@type='location'][@axis eq 'row' or @axis eq 'column']) mod 2) eq 0">location inputs with axis=row or column must come in pairs</sch:assert> |
| 33 | + <sch:assert test="(count(h:input[@type='location'][@axis eq 'x' or @axis eq 'y']) mod 2) eq 0">location inputs with axis=x or y must come in pairs</sch:assert> |
34 | 34 | </sch:rule>
|
35 | 35 | </sch:pattern>
|
36 | 36 | <sch:pattern>
|
37 |
| - <sch:rule context="extent[@action]"> |
38 |
| - <sch:assert test="input and (count(link[@rel='query']) eq 1 or not(exists(link[@rel='query'])))"> Extent Content model: If the action attribute exists: A set of multiple input and zero or one link element with its rel attribute in the "query" state.</sch:assert> |
39 |
| - </sch:rule> |
40 |
| - <sch:rule context="extent[not(@action)]"> |
41 |
| - <sch:assert test="input and link[@rel=('tile','image','features')] and count(link[@rel eq 'query']) <= 1"> Extent Content model: If no action attribute exists: A set of multiple input and one or more link elements with their rel attribute in either the "tile", "image" or "features" state, and zero or one link element with its rel attribute in the "query" state.</sch:assert> |
| 37 | + <sch:rule context="h:extent"> |
| 38 | + <sch:assert test="h:input and h:link[@rel=('tile','image','features')] and count(h:link[@rel eq 'query']) <= 1"> Extent Content model: A set of multiple input and one or more link elements with their rel attribute in either the "tile", "image" or "features" state, and zero or one link element with its rel attribute in the "query" state.</sch:assert> |
42 | 39 | </sch:rule>
|
43 | 40 | </sch:pattern>
|
44 | 41 | <sch:pattern>
|
45 |
| - <sch:rule context="head/link"> |
| 42 | + <sch:rule context="h:head/h:link"> |
46 | 43 | <sch:assert test="exists(@href)">Links in head should have a href attribute (head links should not be templated).</sch:assert>
|
47 | 44 | <sch:report test="exists(@tref)">Links in head should not have a tref attribute (head links should not be templated).</sch:report>
|
48 | 45 | <sch:let name="recognizedRels" value="'alternate' , 'stylesheet' , 'license' , 'self' , 'style' , 'self style', 'style self', 'legend', 'next', 'zoomin', 'zoomout'"></sch:let>
|
49 | 46 | <sch:assert test="exists(@rel) and @rel = $recognizedRels">Unrecognized link@rel value (for head link): <sch:value-of select="@rel"/>. Recognized rel values are: <sch:value-of select="$recognizedRels"/></sch:assert>
|
50 | 47 | </sch:rule>
|
51 |
| - <sch:rule context="head/link[@type]"> |
| 48 | + <sch:rule context="h:head/h:link[@type]"> |
52 | 49 | <sch:let name="recognizedTypes" value="'text/html','text/css','text/mapml'"></sch:let>
|
53 | 50 | <sch:report test="@type = $recognizedTypes">Unrecognized link@type value (for head link): <sch:value-of select="@type"/>. Recognized types are: <sch:value-of select="$recognizedTypes"/></sch:report>
|
54 | 51 | </sch:rule>
|
55 |
| - <sch:rule context="head/link[@projection]"> |
| 52 | + <sch:rule context="h:head/h:link[@projection]"> |
56 | 53 | <sch:report test="@rel ne 'alternate'">projection links must be rel="alternate"</sch:report>
|
57 | 54 | <sch:report test="exists(@type) and @type ne 'text/mapml'">If alternate projections are provided, the @type must be 'text/mapml', or be unspecified</sch:report>
|
58 | 55 | <sch:let name="recognizedProjections" value="'OSMTILE' , 'WGS84', 'CBMTILE', 'APSTILE'"></sch:let>
|
59 | 56 | <sch:report test="upper-case(@projection) = $recognizedProjections">Unrecognized link@projection value: <sch:value-of select="@projection"/></sch:report>
|
60 | 57 | </sch:rule>
|
61 |
| - <sch:rule context="extent/link"> |
| 58 | + <sch:rule context="h:extent/h:link"> |
62 | 59 | <sch:assert test="exists(@tref)">Links in extent should have a tref attribute (extent links must be templated).</sch:assert>
|
63 | 60 | <sch:report test="exists(@href)">Links in extent should not have a href attribute (extent links must be templated).</sch:report>
|
64 | 61 | <sch:let name="recognizedRels" value="'image' , 'tile' , 'query' , 'features'"></sch:let>
|
65 | 62 | <sch:assert test="exists(@rel) and @rel = $recognizedRels">Unrecognized link@rel value (for templated link): <sch:value-of select="@rel"/>. Recognized rel values are: <sch:value-of select="$recognizedRels"/></sch:assert>
|
66 | 63 | </sch:rule>
|
67 |
| - <sch:rule context="extent/link[@type]"> |
| 64 | + <sch:rule context="h:extent/h:link[@type]"> |
68 | 65 | <sch:let name="recognizedTypes" value="'text/mapml','image/png','image/jpeg'"></sch:let>
|
69 | 66 | <sch:assert test="@type = $recognizedTypes">Unrecognized link@type value (for templated link): <sch:value-of select="@type"/>. Recognized types are: <sch:value-of select="$recognizedTypes"/></sch:assert>
|
70 | 67 | </sch:rule>
|
71 |
| - <sch:rule context="input[@name = preceding-sibling::input/@name]"> |
| 68 | + <sch:rule context="h:input[@name = preceding-sibling::h:input/@name]"> |
72 | 69 | <sch:assert test="false()">Duplicate input/@name detected</sch:assert>
|
73 | 70 | </sch:rule>
|
74 |
| - <sch:rule context="input[@type eq 'location' or @type eq 'zoom'][@min][@max][xs:decimal(@min) > xs:decimal(@max)]"> |
| 71 | + <sch:rule context="h:input[@type eq 'location' or @type eq 'zoom'][@min][@max][xs:double(@min) > xs:double(@max)]"> |
75 | 72 | <sch:assert test="false()">@min > @max detected</sch:assert>
|
76 | 73 | </sch:rule>
|
77 |
| - <sch:rule context="link[@tref]"> |
| 74 | + <sch:rule context="h:link[@tref]"> |
78 | 75 | <sch:assert test="local-name(parent::node()) eq 'extent'">templated links can only be in the extent element</sch:assert>
|
79 | 76 | </sch:rule>
|
80 |
| - <sch:rule context="link[@projection]"> |
| 77 | + <sch:rule context="h:link[@projection]"> |
81 | 78 | <!-- this rule doesn't work. don't know why. <sch:assert test="./@rel eq 'alternate'">For alternate projection links, @rel must equal 'alternate'</sch:assert>-->
|
82 | 79 | <sch:assert test="local-name(parent::node()) eq 'head'">Alternate projection links can only be in the head element</sch:assert>
|
83 | 80 | </sch:rule>
|
84 |
| - <sch:rule context="link[@href]"> |
| 81 | + <sch:rule context="h:link[@href]"> |
85 | 82 | <sch:assert test="local-name(parent::node()) ne 'extent'">regular links must not be in the extent element</sch:assert>
|
86 | 83 | </sch:rule>
|
87 |
| - <sch:rule context="link[normalize-space(@rel) = 'self style' or normalize-space(@rel) = 'style self']"> |
88 |
| - <sch:assert test="count(//link[normalize-space(@rel) = 'self style' or normalize-space(@rel) = 'style self']) eq 1">More than one self style or style self link found</sch:assert> |
| 84 | + <sch:rule context="h:link[normalize-space(@rel) = 'self style' or normalize-space(@rel) = 'style self']"> |
| 85 | + <sch:assert test="count(//h:link[normalize-space(@rel) = 'self style' or normalize-space(@rel) = 'style self']) eq 1">More than one self style or style self link found</sch:assert> |
89 | 86 | </sch:rule>
|
90 | 87 | </sch:pattern>
|
91 | 88 | <sch:pattern>
|
92 |
| - <sch:rule context="label"> |
| 89 | + <sch:rule context="h:label"> |
93 | 90 | <sch:assert test="exists(./@for)">A label must have a @for attribute</sch:assert>
|
94 | 91 | <sch:let name="forid" value="./@for"></sch:let>
|
95 | 92 | <sch:assert test="exists(//*[@id eq $forid])">A label must be associated to another element by label@for == element@id</sch:assert>
|
96 | 93 | </sch:rule>
|
97 | 94 | </sch:pattern>
|
98 | 95 | <sch:pattern>
|
99 |
| - <sch:rule context="select[@id]"> |
| 96 | + <sch:rule context="h:select[@id]"> |
100 | 97 | <sch:let name="forid" value="./@id"></sch:let>
|
101 |
| - <sch:assert test="count(//label[@for eq $forid]) eq 1">There must be only one label per labelled (select) element. Duplicated label for id="<sch:value-of select="$forid"/>".</sch:assert> |
| 98 | + <sch:assert test="count(//h:label[@for eq $forid]) eq 1">There must be only one label per labelled (select) element. Duplicated label for id="<sch:value-of select="$forid"/>".</sch:assert> |
102 | 99 | </sch:rule>
|
103 | 100 | </sch:pattern>
|
104 | 101 | <sch:pattern>
|
105 |
| - <sch:rule context="coordinates"> |
| 102 | + <sch:rule context="h:coordinates"> |
106 | 103 | <sch:let name="cs" value="tokenize(normalize-space(string-join((descendant::text()),' ')),' ')"></sch:let>
|
107 | 104 | <sch:assert test="(count($cs) mod 2) eq 0">Coordinates must be a sequence of number pairs</sch:assert>
|
108 | 105 | <sch:assert test="every $c in $cs satisfies ($c castable as xs:double)">Coordinates must all be numeric</sch:assert>
|
109 | 106 | </sch:rule>
|
110 | 107 | </sch:pattern>
|
111 | 108 | <sch:pattern>
|
112 |
| - <sch:rule context="polygon/coordinates"> |
| 109 | + <sch:rule context="h:polygon//h:coordinates"> |
113 | 110 | <sch:let name="cs" value="tokenize(normalize-space(string-join((descendant::text()),' ')),' ')"></sch:let>
|
114 | 111 | <sch:assert test="(count($cs) idiv 2) ge 3">A polygon's coordinates must be a sequence of three or more pairs of numbers</sch:assert>
|
115 | 112 | <sch:let name="first" value="subsequence($cs,1,2)"></sch:let>
|
|
118 | 115 | </sch:rule>
|
119 | 116 | </sch:pattern>
|
120 | 117 | <sch:pattern>
|
121 |
| - <sch:rule context="(multilinestring|linestring)/coordinates "> |
| 118 | + <!-- --> |
| 119 | + <sch:rule context="(h:multilinestring|h:linestring)//h:coordinates "> |
122 | 120 | <sch:let name="cs" value="tokenize(normalize-space(string-join((descendant::text()),' ')),' ')"></sch:let>
|
123 | 121 | <sch:assert test="(count($cs) idiv 2) ge 2">A linestring's coordinates must be a sequence of two or more pairs of numbers</sch:assert>
|
124 | 122 | </sch:rule>
|
125 | 123 | </sch:pattern>
|
126 | 124 | <sch:pattern>
|
127 |
| - <sch:rule context="multipoint/coordinates "> |
| 125 | + <sch:rule context="h:multipoint//h:coordinates "> |
128 | 126 | <sch:let name="cs" value="tokenize(normalize-space(string-join((descendant::text()),' ')),' ')"></sch:let>
|
129 | 127 | <sch:assert test="(count($cs) idiv 2) ge 2">A multipoint's coordinates should be a sequence of two or more pairs of numbers. Should you use a point, instead?</sch:assert>
|
130 | 128 | </sch:rule>
|
131 | 129 | </sch:pattern>
|
132 | 130 | <sch:pattern>
|
133 |
| - <sch:rule context="coordinates//span"> |
| 131 | + <sch:rule context="h:coordinates//h:span"> |
134 | 132 | <sch:let name="cs" value="tokenize(normalize-space(string-join((descendant::text()),' ')),' ')"></sch:let>
|
135 | 133 | <sch:assert test="(count($cs) mod 2) eq 0">A span in coordinates should wrap coordinate pairs.</sch:assert>
|
136 | 134 | <!-- TODO: a test that the first number in a span is an odd number of positions into the overall set of tokens i.e. 1,3,5, etc -->
|
|
0 commit comments