@likecoin/epubcheck-ts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +339 -0
  3. package/dist/index.cjs +1904 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +523 -0
  6. package/dist/index.d.ts +523 -0
  7. package/dist/index.js +1895 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +69 -0
  10. package/schemas/applications.rng +429 -0
  11. package/schemas/aria.rng +3355 -0
  12. package/schemas/block.rng +488 -0
  13. package/schemas/common.rng +1076 -0
  14. package/schemas/container.rng +24 -0
  15. package/schemas/core-scripting.rng +950 -0
  16. package/schemas/data.rng +161 -0
  17. package/schemas/datatypes.rng +401 -0
  18. package/schemas/embed.rng +980 -0
  19. package/schemas/epub-mathml3-inc.rng +161 -0
  20. package/schemas/epub-nav-30.rnc +44 -0
  21. package/schemas/epub-nav-30.rng +19985 -0
  22. package/schemas/epub-nav-30.sch +87 -0
  23. package/schemas/epub-prefix-attr.rng +17 -0
  24. package/schemas/epub-shared-inc.rng +29 -0
  25. package/schemas/epub-ssml-attrs.rng +17 -0
  26. package/schemas/epub-svg-30.rnc +17 -0
  27. package/schemas/epub-svg-30.rng +19903 -0
  28. package/schemas/epub-svg-30.sch +7 -0
  29. package/schemas/epub-svg-forgiving-inc.rng +315 -0
  30. package/schemas/epub-switch.rng +121 -0
  31. package/schemas/epub-trigger.rng +90 -0
  32. package/schemas/epub-type-attr.rng +12 -0
  33. package/schemas/epub-xhtml-30.rnc +6 -0
  34. package/schemas/epub-xhtml-30.rng +19882 -0
  35. package/schemas/epub-xhtml-30.sch +409 -0
  36. package/schemas/epub-xhtml-inc.rng +151 -0
  37. package/schemas/epub-xhtml-integration.rng +565 -0
  38. package/schemas/epub-xhtml-svg-mathml.rng +17 -0
  39. package/schemas/form-datatypes.rng +54 -0
  40. package/schemas/mathml3-common.rng +336 -0
  41. package/schemas/mathml3-content.rng +1552 -0
  42. package/schemas/mathml3-inc.rng +30 -0
  43. package/schemas/mathml3-presentation.rng +2341 -0
  44. package/schemas/mathml3-strict-content.rng +205 -0
  45. package/schemas/media.rng +374 -0
  46. package/schemas/meta.rng +754 -0
  47. package/schemas/microdata.rng +192 -0
  48. package/schemas/ncx.rng +308 -0
  49. package/schemas/ocf-container-30.rnc +37 -0
  50. package/schemas/ocf-container-30.rng +568 -0
  51. package/schemas/opf.rng +15 -0
  52. package/schemas/opf20.rng +513 -0
  53. package/schemas/package-30.rnc +133 -0
  54. package/schemas/package-30.rng +1153 -0
  55. package/schemas/package-30.sch +444 -0
  56. package/schemas/phrase.rng +746 -0
  57. package/schemas/rdfa.rng +552 -0
  58. package/schemas/revision.rng +106 -0
  59. package/schemas/ruby.rng +141 -0
  60. package/schemas/sectional.rng +278 -0
  61. package/schemas/structural.rng +298 -0
  62. package/schemas/tables.rng +420 -0
  63. package/schemas/web-components.rng +184 -0
  64. package/schemas/web-forms.rng +975 -0
  65. package/schemas/web-forms2.rng +1236 -0
@@ -0,0 +1,444 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
3
+
4
+ <ns uri="http://www.idpf.org/2007/opf" prefix="opf"/>
5
+ <ns uri="http://purl.org/dc/elements/1.1/" prefix="dc"/>
6
+
7
+ <!-- Unique ID checks -->
8
+
9
+ <pattern id="opf.uid">
10
+ <rule context="opf:package[@unique-identifier]">
11
+ <let name="uid" value="./normalize-space(@unique-identifier)"/>
12
+ <assert test="/opf:package/opf:metadata/dc:identifier[normalize-space(@id) = $uid]">package element
13
+ unique-identifier attribute does not resolve to a dc:identifier element (given
14
+ reference was "<value-of select="$uid"/>")</assert>
15
+ </rule>
16
+ </pattern>
17
+
18
+ <pattern id="opf.dcterms.modified">
19
+ <rule context="opf:package/opf:metadata">
20
+ <assert test="count(opf:meta[normalize-space(@property)='dcterms:modified' and not(@refines)]) = 1"
21
+ >package dcterms:modified meta element must occur exactly once</assert>
22
+ </rule>
23
+ </pattern>
24
+
25
+ <pattern id="opf.dcterms.modified.syntax">
26
+ <rule context="opf:meta[normalize-space(@property)='dcterms:modified'][not(ancestor::opf:collection)]">
27
+ <assert
28
+ test="matches(normalize-space(.), '^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$')"
29
+ >dcterms:modified illegal syntax (expecting: "CCYY-MM-DDThh:mm:ssZ")</assert>
30
+ </rule>
31
+ </pattern>
32
+
33
+ <!-- Link checks -->
34
+
35
+ <pattern id="opf.link.record">
36
+ <rule context="opf:link[tokenize(@rel,'\s+')='record']">
37
+ <!--<assert test="exists(@media-type)">**checked in java**</assert>-->
38
+ <assert test="empty(@refines)">"record" links only applies to the Publication (must not
39
+ have a "refines" attribute).</assert>
40
+ </rule>
41
+ </pattern>
42
+
43
+ <pattern id="opf.link.voicing">
44
+ <rule context="opf:link[tokenize(@rel,'\s+')='voicing']">
45
+ <!--<assert test="starts-with(normalize-space(@media-type),'audio/')">**checked in java**</assert>-->
46
+ <assert test="exists(@refines)">"voicing" links must have a "refines" attribute.</assert>
47
+ </rule>
48
+ </pattern>
49
+
50
+ <!-- Metadata checks -->
51
+
52
+ <pattern id="opf.refines.relative">
53
+ <rule context="*[not(ancestor::opf:collection)][@refines]">
54
+ <report test="matches(@refines,'[a-zA-Z]([a-zA-Z0-9]|\+|\-|\.)*:')">@refines must be a relative URL</report>
55
+ </rule>
56
+ </pattern>
57
+ <pattern id="opf.refines.by-fragment">
58
+ <rule context="*[not(ancestor::opf:collection)][@refines]">
59
+ <let name="refines-url" value="resolve-uri(@refines)"/>
60
+ <let name="item" value="//opf:manifest/opf:item[resolve-uri(normalize-space(@href))=$refines-url]"/>
61
+ <report test="$item">WARNING: @refines should instead refer to "<value-of
62
+ select="@refines"/>" using a fragment identifier pointing to its manifest item ("#<value-of
63
+ select="$item/@id"/>")
64
+ </report>
65
+ </rule>
66
+ </pattern>
67
+ <pattern id="opf.refines.fragment-exists">
68
+ <rule context="*[not(ancestor::opf:collection)][@refines and starts-with(normalize-space(@refines),'#')]">
69
+ <let name="refines-target-id" value="substring(normalize-space(@refines), 2)"/>
70
+ <assert test="//*[normalize-space(@id)=$refines-target-id]">@refines missing target id: "<value-of
71
+ select="$refines-target-id"/>"</assert>
72
+ </rule>
73
+ </pattern>
74
+
75
+ <pattern id="opf.dc.subject.authority-term">
76
+ <rule context="opf:metadata/dc:subject">
77
+ <let name="id" value="normalize-space(./@id)"/>
78
+ <let name="authority" value="//opf:meta[normalize-space(@property)='authority'][substring(normalize-space(@refines), 2) = $id]"/>
79
+ <let name="term" value="//opf:meta[normalize-space(@property)='term'][substring(normalize-space(@refines), 2) = $id]"/>
80
+ <report test="(count($authority) = 1 and count($term) = 0)">A term property must be associated with a dc:subject when an authority is specified</report>
81
+ <report test="(count($authority) = 0 and count($term) = 1)">An authority property must be associated with a dc:subject when a term is specified</report>
82
+ <report test="(count($authority) &gt; 1 or count($term) &gt; 1)">Only one pair of authority and term properties can be associated with a dc:subject</report>
83
+ </rule>
84
+ </pattern>
85
+
86
+ <pattern id="opf.meta.authority">
87
+ <rule context="opf:meta[normalize-space(@property)='authority']">
88
+ <assert test="exists(../dc:subject[concat('#',normalize-space(@id)) = normalize-space(current()/@refines)])"
89
+ >Property "authority" must refine a "subject" property.</assert>
90
+ <!-- Cardinality is checked in opf.dc.subject.authority-term -->
91
+ </rule>
92
+ </pattern>
93
+
94
+ <pattern id="opf.meta.belongs-to-collection">
95
+ <rule context="opf:meta[normalize-space(@property)='belongs-to-collection']">
96
+ <assert
97
+ test="empty(@refines) or exists(../opf:meta[normalize-space(@id)=substring(normalize-space(current()/@refines),2)][normalize-space(@property)='belongs-to-collection'])"
98
+ >Property "belongs-to-collection" can only refine other "belongs-to-collection"
99
+ properties.</assert>
100
+ </rule>
101
+ </pattern>
102
+
103
+ <pattern id="opf.meta.collection-type">
104
+ <rule context="opf:meta[normalize-space(@property)='collection-type']">
105
+ <assert
106
+ test="exists(../opf:meta[normalize-space(@id)=substring(normalize-space(current()/@refines),2)][normalize-space(@property)='belongs-to-collection'])"
107
+ >Property "collection-type" must refine a "belongs-to-collection" property.</assert>
108
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
109
+ >Property "collection-type" cannot be declared more than once to refine the same "belongs-to-collection" expression.</report>
110
+ </rule>
111
+ </pattern>
112
+
113
+ <pattern id="opf.meta.display-seq">
114
+ <rule context="opf:meta[normalize-space(@property)='display-seq']">
115
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
116
+ >Property "display-seq" cannot be declared more than once to refine the same expression.</report>
117
+ </rule>
118
+ </pattern>
119
+
120
+ <pattern id="opf.meta.file-as">
121
+ <rule context="opf:meta[normalize-space(@property)='file-as']">
122
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
123
+ >Property "file-as" cannot be declared more than once to refine the same expression.</report>
124
+ </rule>
125
+ </pattern>
126
+
127
+ <pattern id="opf.meta.group-position">
128
+ <rule context="opf:meta[normalize-space(@property)='group-position']">
129
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
130
+ >Property "group-position" cannot be declared more than once to refine the same expression.</report>
131
+ </rule>
132
+ </pattern>
133
+
134
+ <pattern id="opf.meta.identifier-type">
135
+ <rule context="opf:meta[normalize-space(@property)='identifier-type']">
136
+ <assert test="exists(../(dc:identifier|dc:source)[concat('#',normalize-space(@id)) = normalize-space(current()/@refines)])"
137
+ >Property "identifier-type" must refine an "identifier" or "source" property.</assert>
138
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
139
+ >Property "identifier-type" cannot be declared more than once to refine the same expression.</report>
140
+ </rule>
141
+ </pattern>
142
+
143
+ <pattern id="opf.meta.role">
144
+ <rule context="opf:meta[normalize-space(@property)='role']">
145
+ <assert test="exists(../(dc:creator|dc:contributor|dc:publisher)[concat('#',normalize-space(@id)) = normalize-space(current()/@refines)])"
146
+ >Property "role" must refine a "creator", "contributor", or "publisher" property.</assert>
147
+ </rule>
148
+ </pattern>
149
+
150
+ <pattern id="opf.meta.source-of">
151
+ <rule context="opf:meta[normalize-space(@property)='source-of']">
152
+ <assert test="normalize-space(.) eq 'pagination'">The "source-of" property must have the
153
+ value "pagination"</assert>
154
+ <assert
155
+ test="exists(@refines) and exists(../dc:source[normalize-space(@id)=substring(normalize-space(current()/@refines),2)])"
156
+ >The "source-of" property must refine a "source" property.</assert>
157
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
158
+ >Property "source-of" cannot be declared more than once to refine the same "source" expression.</report>
159
+ </rule>
160
+ </pattern>
161
+
162
+ <pattern id="opf.meta.term">
163
+ <rule context="opf:meta[normalize-space(@property)='term']">
164
+ <assert test="exists(../dc:subject[concat('#',normalize-space(@id)) = normalize-space(current()/@refines)])"
165
+ >Property "term" must refine a "subject" property.</assert>
166
+ <!-- Cardinality is checked in opf.dc.subject.authority-term -->
167
+ </rule>
168
+ </pattern>
169
+
170
+ <pattern id="opf.meta.title-type">
171
+ <rule context="opf:meta[normalize-space(@property)='title-type']">
172
+ <assert test="exists(../dc:title[concat('#',normalize-space(@id)) = normalize-space(current()/@refines)])"
173
+ >Property "title-type" must refine a "title" property.</assert>
174
+ <report test="exists(preceding-sibling::opf:meta[normalize-space(@property) = normalize-space(current()/@property)][normalize-space(@refines) = normalize-space(current()/@refines)])"
175
+ >Property "title-type" cannot be declared more than once to refine the same "title" expression.</report>
176
+ </rule>
177
+ </pattern>
178
+
179
+ <!-- Item checks -->
180
+
181
+ <pattern id="opf.itemref">
182
+ <rule context="opf:spine/opf:itemref[@idref]">
183
+ <let name="ref" value="./normalize-space(@idref)"/>
184
+ <let name="item" value="//opf:manifest/opf:item[normalize-space(@id) = $ref]"/>
185
+ <assert test="$item">itemref element idref attribute does not resolve to a manifest item
186
+ element</assert>
187
+ </rule>
188
+ </pattern>
189
+
190
+ <pattern id="opf.toc.ncx">
191
+ <rule context="opf:spine[@toc]">
192
+ <let name="ref" value="./normalize-space(@toc)"/>
193
+ <let name="item" value="/opf:package/opf:manifest/opf:item[normalize-space(@id) = $ref]"/>
194
+ <let name="item-media-type" value="normalize-space($item/@media-type)"/>
195
+ <assert test="$item-media-type = 'application/x-dtbncx+xml'">spine element toc attribute
196
+ must reference the NCX manifest item (referenced media type was "<value-of
197
+ select="$item-media-type"/>")</assert>
198
+ </rule>
199
+ </pattern>
200
+
201
+ <pattern id="opf.toc.ncx.2">
202
+ <rule context="opf:item[normalize-space(@media-type)='application/x-dtbncx+xml']">
203
+ <assert test="//opf:spine[@toc]">spine element toc attribute must be set when an NCX is
204
+ included in the publication</assert>
205
+ </rule>
206
+ </pattern>
207
+
208
+ <pattern id="opf.nav.prop">
209
+ <rule context="opf:manifest">
210
+ <let name="item"
211
+ value="//opf:manifest/opf:item[@properties and tokenize(@properties,'\s+') = 'nav']"/>
212
+ <assert test="count($item) = 1">Exactly one manifest item must declare the "nav"
213
+ property (number of "nav" items: <value-of select="count($item)"/>).</assert>
214
+ </rule>
215
+ </pattern>
216
+
217
+ <pattern id="opf.nav.type">
218
+ <rule
219
+ context="opf:manifest/opf:item[@properties and tokenize(@properties,'\s+') = 'nav']">
220
+ <assert test="@media-type = 'application/xhtml+xml'">The manifest item representing the
221
+ Navigation Document must be of the "application/xhtml+xml" type (given type was
222
+ "<value-of select="@media-type"/>")</assert>
223
+ </rule>
224
+ </pattern>
225
+
226
+ <pattern id="opf.datanav.prop">
227
+ <rule context="opf:manifest">
228
+ <let name="item" value="opf:item[tokenize(@properties, '\s+') = 'data-nav']"/>
229
+ <assert test="count($item) le 1">Found <value-of select="count($item)"/> "data-nav" items. The manifest must not include more than one Data Navigation Document.</assert>
230
+ </rule>
231
+ </pattern>
232
+
233
+ <pattern id="opf.cover-image">
234
+ <rule context="opf:manifest">
235
+ <let name="item"
236
+ value="//opf:manifest/opf:item[@properties and tokenize(@properties,'\s+')='cover-image']"/>
237
+ <assert test="count($item) &lt; 2">Multiple occurrences of the "cover-image" property
238
+ (number of "cover-image" items: <value-of select="count($item)"/>).</assert>
239
+ </rule>
240
+ </pattern>
241
+
242
+ <!-- Rendition properties checks -->
243
+
244
+ <pattern id="opf.rendition.globals">
245
+ <rule context="opf:package/opf:metadata">
246
+ <assert test="count(opf:meta[normalize-space(@property)='rendition:flow']) le 1">The "rendition:flow"
247
+ property must not occur more than one time in the package metadata.</assert>
248
+ <assert test="count(opf:meta[normalize-space(@property)='rendition:layout']) le 1">The "rendition:layout"
249
+ property must not occur more than one time in the package metadata.</assert>
250
+ <assert test="count(opf:meta[normalize-space(@property)='rendition:orientation']) le 1">The
251
+ "rendition:orientation" property must not occur more than one time in the package
252
+ metadata.</assert>
253
+ <assert test="count(opf:meta[normalize-space(@property)='rendition:spread']) le 1">The "rendition:spread"
254
+ property must not occur more than one time in the package metadata.</assert>
255
+ <assert test="count(opf:meta[normalize-space(@property)='rendition:viewport'][empty(@refines)]) le 1">The
256
+ "rendition:viewport" property must not occur more than one time as a global value in
257
+ the package metadata.</assert>
258
+ </rule>
259
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)='rendition:flow']">
260
+ <assert test="empty(@refines)">The "rendition:flow" property must not be set on elements
261
+ with a "refines" attribute</assert>
262
+ <assert
263
+ test="normalize-space()=('paginated','scrolled-continuous','scrolled-doc','auto')"
264
+ >The value of the "rendition:flow" property must be either "paginated",
265
+ "scrolled-continuous", "scrolled-doc", or "auto"</assert>
266
+ </rule>
267
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)=('rendition:layout')]">
268
+ <assert test="empty(@refines)">The "rendition:layout" property must not be set on
269
+ elements with a "refines" attribute</assert>
270
+ <assert test="normalize-space()=('reflowable','pre-paginated')">The value of the
271
+ "rendition:layout" property must be either "reflowable" or "pre-paginated"</assert>
272
+ </rule>
273
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)='rendition:orientation']">
274
+ <assert test="empty(@refines)">The "rendition:orientation" property must not be set on
275
+ elements with a "refines" attribute</assert>
276
+ <assert test="normalize-space()=('landscape','portrait','auto')">The value of the
277
+ "rendition:orientation" property must be either "landscape", "portrait" or
278
+ "auto"</assert>
279
+ </rule>
280
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)='rendition:spread']">
281
+ <assert test="empty(@refines)">The "rendition:spread" property must not be set on
282
+ elements with a "refines" attribute</assert>
283
+ <assert test="normalize-space()=('none','landscape','portrait','both','auto')">The value
284
+ of the "rendition:spread" property must be either "none", "landscape", "portrait",
285
+ "both" or "auto"</assert>
286
+ </rule>
287
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)='rendition:spread']">
288
+ <assert test="empty(@refines)">The "rendition:spread" property must not be set on
289
+ elements with a "refines" attribute</assert>
290
+ <assert test="normalize-space()=('none','landscape','portrait','both','auto')">The value
291
+ of the "rendition:spread" property must be either "none", "landscape", "portrait",
292
+ "both" or "auto"</assert>
293
+ </rule>
294
+ <rule context="opf:meta[not(ancestor::opf:collection)][normalize-space(@property)='rendition:viewport']">
295
+ <assert
296
+ test="matches(normalize-space(),'^((width=\d+,\s*height=\d+)|(height=\d+,\s*width=\d+))$')"
297
+ >The value of the "rendition:viewport" property must be of the form "width=x,
298
+ height=y"</assert>
299
+ </rule>
300
+ </pattern>
301
+
302
+ <pattern id="opf.rendition.overrides">
303
+ <rule context="opf:itemref">
304
+ <assert
305
+ test="count(tokenize(@properties,'\s+')[.=('rendition:flow-paginated','rendition:flow-scrolled-continuous','rendition:flow-scrolled-doc','rendition:flow-auto')]) le 1"
306
+ >Properties "rendition:flow-paginated", "rendition:flow-scrolled-continuous",
307
+ "rendition:flow-scrolled-doc" and "rendition:flow-auto" are mutually
308
+ exclusive</assert>
309
+ <assert
310
+ test="count(tokenize(@properties,'\s+')[.=('rendition:layout-reflowable','rendition:layout-pre-paginated')]) le 1"
311
+ >Properties "rendition:layout-reflowable" and "rendition:layout-pre-paginated" are
312
+ mutually exclusive</assert>
313
+ <assert
314
+ test="count(tokenize(@properties,'\s+')[.=('rendition:orientation-landscape','rendition:orientation-portrait','rendition:orientation-auto')]) le 1"
315
+ >Properties "rendition:orientation-landscape", "rendition:orientation-portrait" and
316
+ "rendition:orientation-auto" are mutually exclusive</assert>
317
+ <assert
318
+ test="count(tokenize(@properties,'\s+')[.=('page-spread-right','page-spread-left','rendition:page-spread-center')]) le 1"
319
+ >Properties "page-spread-right", "page-spread-left" and
320
+ "rendition:page-spread-center" are mutually exclusive</assert>
321
+ <assert
322
+ test="count(tokenize(@properties,'\s+')[.=('rendition:spread-portrait','rendition:spread-landscape','rendition:spread-both','rendition:spread-none','rendition:spread-auto')]) le 1"
323
+ >Properties "rendition:spread-portrait", "rendition:spread-landscape",
324
+ "rendition:spread-both", "rendition:spread-none" and "rendition:spread-auto" are
325
+ mutually exclusive</assert>
326
+ </rule>
327
+ </pattern>
328
+
329
+ <pattern id="opf.collection.refines-restriction">
330
+ <rule context="opf:collection/opf:metadata/*[@refines]">
331
+ <let name="refines-target-id" value="substring(normalize-space(@refines), 2)"/>
332
+ <assert
333
+ test="starts-with(normalize-space(@refines),'#') and ancestor::opf:collection[not(ancestor::opf:collection)]//*[normalize-space(@id)=$refines-target-id]"
334
+ > @refines must point to an element within the current collection </assert>
335
+ </rule>
336
+ </pattern>
337
+
338
+ <pattern id="opf_guideReferenceUnique">
339
+ <!-- guide/reference element should be unique (#493) -->
340
+ <rule context="opf:reference">
341
+ <let name="current_type_normalized" value="normalize-space(lower-case(@type))"/>
342
+ <let name="current_href_normalized" value="normalize-space(lower-case(@href))"/>
343
+ <assert test="
344
+ count(//opf:reference[
345
+ normalize-space(lower-case(@type)) = $current_type_normalized and
346
+ normalize-space(lower-case(@href)) = $current_href_normalized
347
+ ]) le 1">WARNING: Duplicate "reference" elements with the same "type" and "href" attributes</assert>
348
+ </rule>
349
+ </pattern>
350
+
351
+ <include href="./mod/id-unique.sch"/>
352
+
353
+ <!-- Media overlay checks -->
354
+
355
+ <pattern id="opf.duration.metadata.item">
356
+ <rule context="opf:meta[normalize-space(@property)='media:duration']">
357
+ <assert
358
+ test="matches(normalize-space(),'^(([0-9]+:[0-5][0-9]:[0-5][0-9](\.[0-9]+)?)|((\s*)[0-5][0-9]:[0-5][0-9](\.[0-9]+)?(\s*))|((\s*)[0-9]+(\.[0-9]+)?(h|min|s|ms)?(\s*)))$')"
359
+ >The value of the media:duration property must be a valid SMIL3 clock value</assert>
360
+ </rule>
361
+ </pattern>
362
+
363
+ <pattern id="opf.media.overlay">
364
+ <rule context="opf:item[@media-overlay]">
365
+ <let name="ref" value="./normalize-space(@media-overlay)"/>
366
+ <let name="item" value="//opf:manifest/opf:item[normalize-space(@id) = $ref]"/>
367
+ <let name="item-media-type" value="normalize-space($item/@media-type)"/>
368
+ <let name="media-type" value="normalize-space(@media-type)"/>
369
+ <assert test="$item-media-type = 'application/smil+xml'">media overlay items must be of
370
+ the "application/smil+xml" type (given type was "<value-of select="$item-media-type"
371
+ />")</assert>
372
+ <assert test="$media-type='application/xhtml+xml' or $media-type='image/svg+xml'"
373
+ >The media-overlay attribute is only allowed on XHTML and SVG content documents.</assert>
374
+ </rule>
375
+ </pattern>
376
+
377
+ <pattern id="opf.media.overlay.metadata.global">
378
+ <rule context="opf:manifest[opf:item[@media-overlay]]">
379
+ <assert test="//opf:meta[normalize-space(@property)='media:duration' and not (@refines)]">global
380
+ media:duration meta element not set</assert>
381
+ </rule>
382
+ </pattern>
383
+
384
+ <pattern id="opf.media.overlay.metadata.item">
385
+ <rule context="opf:manifest/opf:item[@media-overlay]">
386
+ <let name="mo-idref" value="normalize-space(@media-overlay)"/>
387
+ <let name="mo-item" value="//opf:item[normalize-space(@id) = $mo-idref]"/>
388
+ <let name="mo-item-id" value="$mo-item/normalize-space(@id)"/>
389
+ <let name="mo-item-uri" value="concat('#', $mo-item-id)"/>
390
+ <assert test="//opf:meta[normalize-space(@property)='media:duration' and normalize-space(@refines) = $mo-item-uri ]">item
391
+ media:duration meta element not set (expecting: meta property='media:duration'
392
+ refines='<value-of select="$mo-item-uri"/>')</assert>
393
+ </rule>
394
+ </pattern>
395
+
396
+ <pattern id="opf.media.overlay.metadata.active-class">
397
+ <rule context="opf:package/opf:metadata">
398
+ <assert test="count(opf:meta[normalize-space(@property)='media:active-class']) le 1">The 'active-class' property must not occur more than one time in the package
399
+ metadata.</assert>
400
+ </rule>
401
+ <rule context="opf:meta[normalize-space(@property)='media:active-class']">
402
+ <report test="@refines"> @refines must not be used with the media:active-class property</report>
403
+ <report test="contains(normalize-space(.),' ')">the 'active-class' property must define a single class name</report>
404
+ </rule>
405
+ </pattern>
406
+
407
+ <pattern id="opf.media.overlay.metadata.playback-active-class">
408
+ <rule context="opf:package/opf:metadata">
409
+ <assert test="count(opf:meta[normalize-space(@property)='media:playback-active-class']) le 1">The 'playback-active-class' property must not occur more than one time in the package
410
+ metadata.</assert>
411
+ </rule>
412
+ <rule context="opf:meta[normalize-space(@property)='media:playback-active-class']">
413
+ <report test="@refines"> @refines must not be used with the media:playback-active-class property</report>
414
+ <report test="contains(normalize-space(.),' ')">the 'playback-active-class' property must define a single class name</report>
415
+ </rule>
416
+ </pattern>
417
+
418
+
419
+
420
+ <!-- EPUB 3.2 New Checks -->
421
+
422
+ <pattern id="opf.spine.duplicate.refs">
423
+ <rule context="opf:itemref">
424
+ <report test="normalize-space(./@idref) = preceding-sibling::opf:itemref/normalize-space(@idref)">Itemref refers to the same manifest entry as a previous itemref</report>
425
+ </rule>
426
+ </pattern>
427
+
428
+ <!-- EPUB 3.2 Deprecated Features -->
429
+
430
+ <pattern id="opf.bindings.deprecated">
431
+ <rule context="opf:package/opf:bindings">
432
+ <report test=".">WARNING: Use of the bindings element is deprecated</report>
433
+ </rule>
434
+ </pattern>
435
+
436
+
437
+ <!--FIXME deprecation should be in vocab-->
438
+ <pattern id="opf.meta.meta-auth.deprecated">
439
+ <rule context="opf:metadata/opf:meta[normalize-space(@property)='meta-auth']">
440
+ <report test=".">WARNING: Use of the meta-auth property is deprecated</report>
441
+ </rule>
442
+ </pattern>
443
+
444
+ </schema>