nora_mark 0.2beta3 → 0.2beta4
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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/README.md +17 -12
- data/example/nora-simple.css +52 -0
- data/example/noramark-reference-ja.nora +246 -0
- data/example/noramark-reference-ja_00001.xhtml +187 -0
- data/lib/nora_mark/html/{abstract_item_writer.rb → abstract_node_writer.rb} +3 -3
- data/lib/nora_mark/html/context.rb +3 -21
- data/lib/nora_mark/html/frontmatter_writer.rb +33 -0
- data/lib/nora_mark/html/generator.rb +122 -100
- data/lib/nora_mark/html/pages.rb +3 -9
- data/lib/nora_mark/html/paragraph_writer.rb +27 -23
- data/lib/nora_mark/html/tag_writer.rb +33 -34
- data/lib/nora_mark/html/writer_selector.rb +3 -3
- data/lib/nora_mark/node.rb +31 -0
- data/lib/nora_mark/parser.kpeg +133 -79
- data/lib/nora_mark/parser.kpeg.rb +1822 -1526
- data/lib/nora_mark/parser.rb +4 -23
- data/lib/nora_mark/version.rb +1 -1
- data/lib/nora_mark.rb +7 -2
- data/nora_mark.gemspec +1 -0
- data/spec/epub30-schemas/epub-nav-30.nvdl +16 -0
- data/spec/epub30-schemas/epub-nav-30.rnc +10 -0
- data/spec/epub30-schemas/epub-nav-30.sch +72 -0
- data/spec/epub30-schemas/epub-svg-30.nvdl +15 -0
- data/spec/epub30-schemas/epub-svg-30.rnc +15 -0
- data/spec/epub30-schemas/epub-svg-30.sch +10 -0
- data/spec/epub30-schemas/epub-xhtml-30.nvdl +15 -0
- data/spec/epub30-schemas/epub-xhtml-30.rnc +37 -0
- data/spec/epub30-schemas/epub-xhtml-30.sch +377 -0
- data/spec/epub30-schemas/epub30-catalog.xml +335 -0
- data/spec/epub30-schemas/media-overlay-30.nvdl +14 -0
- data/spec/epub30-schemas/media-overlay-30.rnc +46 -0
- data/spec/epub30-schemas/media-overlay-30.sch +9 -0
- data/spec/epub30-schemas/mod/datatypes.rnc +143 -0
- data/spec/epub30-schemas/mod/epub-mathml3-30.rnc +74 -0
- data/spec/epub30-schemas/mod/epub-prefix-attr.rnc +8 -0
- data/spec/epub30-schemas/mod/epub-ssml-attrs.rnc +11 -0
- data/spec/epub30-schemas/mod/epub-svg11-30.rnc +12 -0
- data/spec/epub30-schemas/mod/epub-svg11-re.sch +7 -0
- data/spec/epub30-schemas/mod/epub-switch.rnc +32 -0
- data/spec/epub30-schemas/mod/epub-trigger.rnc +17 -0
- data/spec/epub30-schemas/mod/epub-type-attr.rnc +7 -0
- data/spec/epub30-schemas/mod/epub-xhtml-mathml3-30.rnc +5 -0
- data/spec/epub30-schemas/mod/epub-xhtml-svg11-30.rnc +6 -0
- data/spec/epub30-schemas/mod/html5/LICENSE +23 -0
- data/spec/epub30-schemas/mod/html5/README +21 -0
- data/spec/epub30-schemas/mod/html5/html5-aria-30.rnc +105 -0
- data/spec/epub30-schemas/mod/html5/html5-attrib-30.rnc +44 -0
- data/spec/epub30-schemas/mod/html5/html5-document-30.rnc +44 -0
- data/spec/epub30-schemas/mod/html5/html5-edit-30.rnc +24 -0
- data/spec/epub30-schemas/mod/html5/html5-embed-30.rnc +155 -0
- data/spec/epub30-schemas/mod/html5/html5-forms-30.rnc +431 -0
- data/spec/epub30-schemas/mod/html5/html5-grouping-30.rnc +115 -0
- data/spec/epub30-schemas/mod/html5/html5-interactive-30.rnc +86 -0
- data/spec/epub30-schemas/mod/html5/html5-models-30.rnc +10 -0
- data/spec/epub30-schemas/mod/html5/html5-phrasing-30.rnc +134 -0
- data/spec/epub30-schemas/mod/html5/html5-script-30.rnc +164 -0
- data/spec/epub30-schemas/mod/html5/html5-sections-30.rnc +58 -0
- data/spec/epub30-schemas/mod/html5/html5-style-30.rnc +18 -0
- data/spec/epub30-schemas/mod/id-unique.sch +10 -0
- data/spec/epub30-schemas/mod/mathml/LICENSE +3 -0
- data/spec/epub30-schemas/mod/mathml/mathml3-common.rnc +84 -0
- data/spec/epub30-schemas/mod/mathml/mathml3-content.rnc +373 -0
- data/spec/epub30-schemas/mod/mathml/mathml3-presentation.rnc +536 -0
- data/spec/epub30-schemas/mod/mathml/mathml3-strict-content.rnc +60 -0
- data/spec/epub30-schemas/mod/security/LICENSE +4 -0
- data/spec/epub30-schemas/mod/security/Lenient-Encryption11-ghc.rnc +41 -0
- data/spec/epub30-schemas/mod/security/Lenient-Encryption11.rnc +39 -0
- data/spec/epub30-schemas/mod/security/Lenient-Signature-exclusiveC14N.rnc +25 -0
- data/spec/epub30-schemas/mod/security/Lenient-Signature11-properties-exclusiveC14N.rnc +32 -0
- data/spec/epub30-schemas/mod/security/Lenient-Signature11-properties.rnc +30 -0
- data/spec/epub30-schemas/mod/security/Lenient-Signature11.rnc +28 -0
- data/spec/epub30-schemas/mod/security/Strict-Encryption.rnc +27 -0
- data/spec/epub30-schemas/mod/security/Strict-Signature.rnc +22 -0
- data/spec/epub30-schemas/mod/security/exc-c14n.rnc +39 -0
- data/spec/epub30-schemas/mod/security/security_any.rnc +15 -0
- data/spec/epub30-schemas/mod/security/xenc-allowAnyForeign.rnc +25 -0
- data/spec/epub30-schemas/mod/security/xenc-schema-11.rnc +96 -0
- data/spec/epub30-schemas/mod/security/xenc-schema.rnc +145 -0
- data/spec/epub30-schemas/mod/security/xenc11-allowAnyForeign.rnc +19 -0
- data/spec/epub30-schemas/mod/security/xmldsig-allowAnyForeign.rnc +47 -0
- data/spec/epub30-schemas/mod/security/xmldsig-core-schema.rnc +276 -0
- data/spec/epub30-schemas/mod/security/xmldsig-filter2.rnc +16 -0
- data/spec/epub30-schemas/mod/security/xmldsig-properties-schema.rnc +34 -0
- data/spec/epub30-schemas/mod/security/xmldsig11-allowAnyForeign.rnc +18 -0
- data/spec/epub30-schemas/mod/security/xmldsig11-schema.rnc +133 -0
- data/spec/epub30-schemas/mod/security/xmlsec-ghc-allowAnyForeign.rnc +21 -0
- data/spec/epub30-schemas/mod/security/xmlsec-ghc-schema.rnc +42 -0
- data/spec/epub30-schemas/mod/svg11/LICENSE +1 -0
- data/spec/epub30-schemas/mod/svg11/README.txt +8 -0
- data/spec/epub30-schemas/mod/svg11/svg11-flat.rnc +3999 -0
- data/spec/epub30-schemas/ocf-container-30.rnc +16 -0
- data/spec/epub30-schemas/ocf-encryption-30.rnc +12 -0
- data/spec/epub30-schemas/ocf-signatures-30.rnc +8 -0
- data/spec/epub30-schemas/package-30.nvdl +14 -0
- data/spec/epub30-schemas/package-30.rnc +91 -0
- data/spec/epub30-schemas/package-30.sch +137 -0
- data/spec/jing-20091111/bin/jing.jar +0 -0
- data/spec/nora_mark_spec.rb +229 -68
- data/spec/spec_helper.rb +16 -0
- metadata +179 -6
- data/lib/nora_mark/html/header_writer.rb +0 -35
- data/spec/fixture/test_src_ja.nora +0 -50
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
default namespace = "urn:oasis:names:tc:opendocument:xmlns:container"
|
|
3
|
+
include "./mod/datatypes.rnc"
|
|
4
|
+
|
|
5
|
+
start = ocf.container
|
|
6
|
+
|
|
7
|
+
ocf.container = element container {
|
|
8
|
+
attribute version { '1.0' } &
|
|
9
|
+
element rootfiles {
|
|
10
|
+
element rootfile {
|
|
11
|
+
attribute full-path { datatype.URI } &
|
|
12
|
+
attribute media-type { 'application/oebps-package+xml' }
|
|
13
|
+
}+
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
default namespace = "urn:oasis:names:tc:opendocument:xmlns:container"
|
|
2
|
+
start = element encryption {
|
|
3
|
+
grammar {
|
|
4
|
+
include "mod/security/Lenient-Encryption11-ghc.rnc" {
|
|
5
|
+
start = xenc_EncryptedData | xenc_EncryptedKey
|
|
6
|
+
}
|
|
7
|
+
xenc_EncryptionMethodOtherParams |=
|
|
8
|
+
attribute Algorithm { xsd:anyURI "http://www.idpf.org/2008/embedding" }
|
|
9
|
+
xenc_EncryptionAlgorithms |=
|
|
10
|
+
xsd:anyURI "http://www.idpf.org/2008/embedding"
|
|
11
|
+
}+
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0" startMode="package">
|
|
3
|
+
<mode name="package">
|
|
4
|
+
<namespace ns="http://www.idpf.org/2007/opf">
|
|
5
|
+
<validate schema="package-30.rnc" schemaType="application/relax-ng-compact-syntax"/>
|
|
6
|
+
<validate schema="package-30.sch"/>
|
|
7
|
+
</namespace>
|
|
8
|
+
</mode>
|
|
9
|
+
<mode name="attach">
|
|
10
|
+
<anyNamespace>
|
|
11
|
+
<attach/>
|
|
12
|
+
</anyNamespace>
|
|
13
|
+
</mode>
|
|
14
|
+
</rules>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
default namespace = "http://www.idpf.org/2007/opf"
|
|
4
|
+
namespace opf = "http://www.idpf.org/2007/opf"
|
|
5
|
+
namespace dc = "http://purl.org/dc/elements/1.1/"
|
|
6
|
+
|
|
7
|
+
include "./mod/datatypes.rnc"
|
|
8
|
+
include "./mod/epub-prefix-attr.rnc"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
start = element package { opf.package.attlist & opf.package.content }
|
|
12
|
+
|
|
13
|
+
opf.package.attlist &= opf.version.attr & opf.unique.identifier.attr & opf.id.attr? & epub.prefix.attr? & opf.i18n.attrs
|
|
14
|
+
opf.version.attr = attribute version { '3.0' }
|
|
15
|
+
opf.unique.identifier.attr = attribute unique-identifier { datatype.IDREF }
|
|
16
|
+
|
|
17
|
+
opf.package.content = opf.metadata, opf.manifest, opf.spine, opf.guide?, opf.bindings?
|
|
18
|
+
|
|
19
|
+
opf.metadata = element metadata { opf.id.attr? & opf.i18n.attrs & opf.metadata.content }
|
|
20
|
+
opf.metadata.content = opf.dc.elems & opf.meta* & opf.link*
|
|
21
|
+
|
|
22
|
+
opf.meta = element meta {
|
|
23
|
+
(opf.property.attr & opf.refines.attr? & opf.id.attr? & opf.scheme.attr? & opf.i18n.attrs & datatype.string.nonempty)
|
|
24
|
+
| (attribute name { text } & attribute content { text }) #legacy
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
opf.link = element link { opf.href.attr & opf.rel.attr & opf.id.attr? & opf.refines.attr? & opf.media-type.attr? }
|
|
28
|
+
|
|
29
|
+
opf.property.attr = attribute property { datatype.property }
|
|
30
|
+
opf.rel.attr = attribute rel { datatype.properties }
|
|
31
|
+
opf.scheme.attr = attribute scheme { datatype.property }
|
|
32
|
+
opf.refines.attr = attribute refines { datatype.URI }
|
|
33
|
+
|
|
34
|
+
opf.dc.elems = element dc:identifier { opf.id.attr? & datatype.string.nonempty }+
|
|
35
|
+
& element dc:title { opf.dc.attlist & datatype.string.nonempty }+
|
|
36
|
+
& element dc:language { opf.id.attr? & datatype.languagecode }+
|
|
37
|
+
& element dc:date { opf.id.attr? & datatype.date.or.dateTime }?
|
|
38
|
+
& element dc:source { opf.dc.attlist & datatype.string.nonempty }?
|
|
39
|
+
& element dc:type { opf.id.attr? & datatype.string.nonempty }?
|
|
40
|
+
& element dc:format { opf.id.attr? & datatype.string.nonempty }*
|
|
41
|
+
& element dc:creator { opf.dc.attlist & datatype.string.nonempty }*
|
|
42
|
+
& element dc:subject { opf.dc.attlist & datatype.string.nonempty }*
|
|
43
|
+
& element dc:description { opf.dc.attlist & datatype.string.nonempty }*
|
|
44
|
+
& element dc:publisher { opf.dc.attlist & datatype.string.nonempty }*
|
|
45
|
+
& element dc:contributor { opf.dc.attlist & datatype.string.nonempty }*
|
|
46
|
+
& element dc:relation { opf.dc.attlist & datatype.string.nonempty }*
|
|
47
|
+
& element dc:coverage { opf.dc.attlist & datatype.string.nonempty }*
|
|
48
|
+
& element dc:rights { opf.dc.attlist & datatype.string.nonempty }*
|
|
49
|
+
|
|
50
|
+
opf.dc.attlist = opf.id.attr? & opf.i18n.attrs
|
|
51
|
+
|
|
52
|
+
opf.manifest = element manifest { opf.manifest.attlist & opf.manifest.content }
|
|
53
|
+
opf.manifest.attlist &= opf.id.attr?
|
|
54
|
+
opf.manifest.content = opf.item+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
opf.item = element item { opf.item.attlist }
|
|
58
|
+
opf.item.attlist &= opf.id.attr & opf.href.attr & opf.media-type.attr & opf.fallback.attr? & opf.media-overlay.attr? & opf.properties.attr?
|
|
59
|
+
|
|
60
|
+
opf.fallback.attr = attribute fallback { datatype.IDREF }
|
|
61
|
+
opf.media-overlay.attr = attribute media-overlay { datatype.IDREF }
|
|
62
|
+
opf.properties.attr = attribute properties { datatype.properties }
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
opf.spine = element spine { opf.spine.attlist & opf.spine.content }
|
|
66
|
+
opf.spine.attlist &= opf.id.attr? & opf.spine.toc.attr? & opf.ppd.attr?
|
|
67
|
+
opf.spine.toc.attr = attribute toc { datatype.IDREF }
|
|
68
|
+
opf.ppd.attr = attribute page-progression-direction { 'ltr' | 'rtl' | 'default'}
|
|
69
|
+
opf.spine.content = opf.itemref+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
opf.itemref = element itemref { opf.itemref.attlist }
|
|
73
|
+
opf.itemref.attlist &= opf.itemref.idref.attr & opf.itemref.linear.attr? & opf.id.attr? & opf.properties.attr?
|
|
74
|
+
opf.itemref.idref.attr = attribute idref { datatype.IDREF }
|
|
75
|
+
opf.itemref.linear.attr = attribute linear { 'yes' | 'no' }
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
opf.guide = element guide { opf.reference+ }
|
|
79
|
+
opf.reference = element reference { opf.href.attr & attribute type { datatype.text } & attribute title { datatype.text }?}
|
|
80
|
+
|
|
81
|
+
opf.bindings = element bindings { opf.bindings.mediaType+ }
|
|
82
|
+
opf.bindings.mediaType = element mediaType { opf.bindings.mediaType.attlist }
|
|
83
|
+
opf.bindings.mediaType.attlist &= opf.media-type.attr & attribute handler { datatype.IDREF }
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
opf.media-type.attr = attribute media-type { datatype.mimetype }
|
|
87
|
+
opf.href.attr = attribute href { datatype.URI }
|
|
88
|
+
opf.id.attr = attribute id { datatype.ID }
|
|
89
|
+
opf.i18n.attrs = opf.xml.lang.attr? & opf.dir.attr?
|
|
90
|
+
opf.xml.lang.attr = attribute xml:lang { datatype.languagecode }
|
|
91
|
+
opf.dir.attr = attribute dir { 'ltr' | 'rtl' }
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
<pattern id="opf.uid">
|
|
8
|
+
<rule context="opf:package[@unique-identifier]">
|
|
9
|
+
<let name="uid" value="./@unique-identifier" />
|
|
10
|
+
<assert test="/opf:package/opf:metadata/dc:identifier[@id = $uid]"
|
|
11
|
+
>package element unique-identifier attribute does not resolve to a dc:identifier element (given reference was '<value-of select="$uid"/>')</assert>
|
|
12
|
+
</rule>
|
|
13
|
+
</pattern>
|
|
14
|
+
|
|
15
|
+
<pattern id="opf.dcterms.modified">
|
|
16
|
+
<rule context="opf:metadata">
|
|
17
|
+
<assert test="count(opf:meta[@property='dcterms:modified' and not(@refines)]) = 1"
|
|
18
|
+
>package dcterms:modified meta element must occur exactly once</assert>
|
|
19
|
+
</rule>
|
|
20
|
+
</pattern>
|
|
21
|
+
|
|
22
|
+
<pattern id="opf.dcterms.modified.syntax">
|
|
23
|
+
<rule context="opf:meta[@property='dcterms:modified']">
|
|
24
|
+
<assert test="matches(normalize-space(.), '^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$')"
|
|
25
|
+
>dcterms:modified illegal syntax (expecting: 'CCYY-MM-DDThh:mm:ssZ')</assert>
|
|
26
|
+
</rule>
|
|
27
|
+
</pattern>
|
|
28
|
+
|
|
29
|
+
<pattern id="opf.refines.relative">
|
|
30
|
+
<rule context="*[@refines and starts-with(@refines,'#')]">
|
|
31
|
+
<let name="refines-target-id" value="substring(@refines, 2)" />
|
|
32
|
+
<assert test="//*[@id=$refines-target-id]"
|
|
33
|
+
>@refines missing target id: '<value-of select="$refines-target-id"/>'</assert>
|
|
34
|
+
</rule>
|
|
35
|
+
</pattern>
|
|
36
|
+
|
|
37
|
+
<pattern id="opf.itemref">
|
|
38
|
+
<rule context="opf:spine/opf:itemref[@idref]">
|
|
39
|
+
<let name="ref" value="./@idref" />
|
|
40
|
+
<let name="item" value="//opf:manifest/opf:item[@id = $ref]"/>
|
|
41
|
+
<let name="item-media-type" value="$item/@media-type" />
|
|
42
|
+
<assert test="$item"
|
|
43
|
+
>itemref element idref attribute does not resolve to a manifest item element</assert>
|
|
44
|
+
</rule>
|
|
45
|
+
</pattern>
|
|
46
|
+
|
|
47
|
+
<pattern id="opf.fallback.ref">
|
|
48
|
+
<rule context="opf:item[@fallback]">
|
|
49
|
+
<let name="ref" value="./@fallback" />
|
|
50
|
+
<let name="item" value="/opf:package/opf:manifest/opf:item[@id = $ref]"/>
|
|
51
|
+
<assert test="$item and $item/@id != ./@id"
|
|
52
|
+
>manifest item element fallback attribute must resolve to another manifest item (given reference was '<value-of select="$ref"/>')</assert>
|
|
53
|
+
</rule>
|
|
54
|
+
</pattern>
|
|
55
|
+
|
|
56
|
+
<pattern id="opf.media.overlay">
|
|
57
|
+
<rule context="opf:item[@media-overlay]">
|
|
58
|
+
<let name="ref" value="./@media-overlay" />
|
|
59
|
+
<let name="item" value="//opf:manifest/opf:item[@id = $ref]" />
|
|
60
|
+
<let name="item-media-type" value="$item/@media-type" />
|
|
61
|
+
<assert test="$item-media-type = 'application/smil+xml'"
|
|
62
|
+
>media overlay items must be of the 'application/smil+xml' type (given type was '<value-of select="$item-media-type"/>')</assert>
|
|
63
|
+
</rule>
|
|
64
|
+
</pattern>
|
|
65
|
+
|
|
66
|
+
<pattern id="opf.media.overlay.metadata.global">
|
|
67
|
+
<rule context="opf:manifest[opf:item[@media-overlay]]">
|
|
68
|
+
<assert test="//opf:meta[@property='media:duration' and not (@refines)]"
|
|
69
|
+
>global media:duration meta element not set</assert>
|
|
70
|
+
</rule>
|
|
71
|
+
</pattern>
|
|
72
|
+
|
|
73
|
+
<pattern id="opf.media.overlay.metadata.item">
|
|
74
|
+
<rule context="opf:manifest/opf:item[@media-overlay]">
|
|
75
|
+
<let name="mo-idref" value="@media-overlay"/>
|
|
76
|
+
<let name="mo-item" value="//opf:item[@id = $mo-idref]"/>
|
|
77
|
+
<let name="mo-item-id" value="$mo-item/@id"/>
|
|
78
|
+
<let name="mo-item-uri" value="concat('#', $mo-item-id)"/>
|
|
79
|
+
<assert test="//opf:meta[@property='media:duration' and @refines = $mo-item-uri ]"
|
|
80
|
+
>item media:duration meta element not set (expecting: meta property='media:duration' refines='<value-of select="$mo-item-uri"/>')</assert>
|
|
81
|
+
</rule>
|
|
82
|
+
</pattern>
|
|
83
|
+
|
|
84
|
+
<pattern id="opf.bindings.handler">
|
|
85
|
+
<rule context="opf:bindings/opf:mediaType">
|
|
86
|
+
<let name="ref" value="./@handler" />
|
|
87
|
+
<let name="item" value="//opf:manifest/opf:item[@id = $ref]" />
|
|
88
|
+
<let name="item-media-type" value="$item/@media-type" />
|
|
89
|
+
<assert test="$item-media-type = 'application/xhtml+xml'"
|
|
90
|
+
>manifest items referenced from the handler attribute of a bindings mediaType element must be of the 'application/xhtml+xml' type (given type was '<value-of select="$item-media-type"/>')</assert>
|
|
91
|
+
</rule>
|
|
92
|
+
</pattern>
|
|
93
|
+
|
|
94
|
+
<pattern id="opf.toc.ncx">
|
|
95
|
+
<rule context="opf:spine[@toc]">
|
|
96
|
+
<let name="ref" value="./@toc" />
|
|
97
|
+
<let name="item" value="/opf:package/opf:manifest/opf:item[@id = $ref]"/>
|
|
98
|
+
<let name="item-media-type" value="$item/@media-type" />
|
|
99
|
+
<assert test="$item-media-type = 'application/x-dtbncx+xml'"
|
|
100
|
+
>spine element toc attribute must reference the NCX manifest item (referenced media type was '<value-of select="$item-media-type"/>')</assert>
|
|
101
|
+
</rule>
|
|
102
|
+
</pattern>
|
|
103
|
+
|
|
104
|
+
<pattern id="opf.toc.ncx.2">
|
|
105
|
+
<rule context="opf:item[@media-type='application/x-dtbncx+xml']">
|
|
106
|
+
<assert test="//opf:spine[@toc]"
|
|
107
|
+
>spine element toc attribute must be set when an NCX is included in the publication</assert>
|
|
108
|
+
</rule>
|
|
109
|
+
</pattern>
|
|
110
|
+
|
|
111
|
+
<pattern id="opf.nav.prop">
|
|
112
|
+
<rule context="opf:manifest">
|
|
113
|
+
<let name="item" value="//opf:manifest/opf:item[@properties and (some $token in tokenize(@properties,' ') satisfies (normalize-space($token) eq 'nav'))]" />
|
|
114
|
+
<assert test="count($item) = 1"
|
|
115
|
+
>Exactly one manifest item must declare the 'nav' property (number of 'nav' items: <value-of select="count($item)"/>).</assert>
|
|
116
|
+
</rule>
|
|
117
|
+
</pattern>
|
|
118
|
+
|
|
119
|
+
<pattern id="opf.nav.type">
|
|
120
|
+
<rule context="opf:manifest/opf:item[@properties and (some $token in tokenize(@properties,' ') satisfies (normalize-space($token) eq 'nav'))]">
|
|
121
|
+
<assert test="@media-type = 'application/xhtml+xml'"
|
|
122
|
+
>The manifest item representing the Navigation Document must be of the 'application/xhtml+xml' type (given type was '<value-of select="@media-type"/>')</assert>
|
|
123
|
+
</rule>
|
|
124
|
+
</pattern>
|
|
125
|
+
|
|
126
|
+
<pattern id="opf.cover-image">
|
|
127
|
+
<rule context="opf:manifest">
|
|
128
|
+
<let name="item" value="//opf:manifest/opf:item[@properties and (some $token in tokenize(@properties,' ') satisfies (normalize-space($token) eq 'cover-image'))]" />
|
|
129
|
+
<assert test="count($item) < 2"
|
|
130
|
+
>Multiple occurrences of the 'cover-image' property (number of 'cover-image' items: <value-of select="count($item)"/>).</assert>
|
|
131
|
+
</rule>
|
|
132
|
+
</pattern>
|
|
133
|
+
|
|
134
|
+
<include href="./mod/id-unique.sch"/>
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
</schema>
|
|
Binary file
|