/
epub-mathml3-inc.rnc
91 lines (82 loc) · 3.26 KB
/
epub-mathml3-inc.rnc
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
default namespace m = "http://www.w3.org/1998/Math/MathML"
namespace local = ""
namespace x = "http://www.w3.org/1999/xhtml"
namespace ev = "http://www.w3.org/2001/xml-events"
namespace ssml = "http://www.w3.org/2001/10/synthesis"
namespace epub = "http://www.idpf.org/2007/ops"
# #####################################################################
#
# MathML validation based on the schemas from the Nu Html Checker,
# with the following changes:
# - Content MathML is only allowed in annotation-xml
# - annotation-xml follows the restrictions defined in
# EPUB Content Documents
# - EPUB SSML attributes are allowed
#
# #####################################################################
include "mathml/mathml3-inc.rnc" {
# extend to circumvent datatype collisions
NonMathMLAtt =
attribute * - (local:* | m:* | xml:* | x:* | ev:* | ssml:* | epub:*) {
datatype.string
}
# as ops allows presentation mathml only at top level, kill the contribution to MathExpression
MathExpression = semantics | PresentationExpression
# override annotation-xml with EPUB restrictions
annotation-xml = epub.annotation-xml
}
# Common attribute extensions
# - epub:type
CommonAtt &= epub.type.attr?
# - SSML attributes
CommonAtt &= epub.ssml.ph.attr?
# - xml:base
CommonAtt &= common.attrs.xmlbase?
# - ARIA
CommonAtt &= aria.global?
annotation-xml.model.xhtml |= common.inner.flow
annotation-xml.model.svg |= svg
# The following comes from validator.nu’s xhtml5-svg-mathml.rnc driver:
# in our integration, <mtext> is the only MathML "token element" that can
# contain HTML element content; the <mi>, <mn>, <mo> and <ms> elements
# cannot; see http://www.w3.org/Bugs/Public/show_bug.cgi?id=9859#c8 for a
# rationale
mtext.content |= common.elem.phrasing
# EPUB very specific annotation-xml restrictions:
epub.annotation-xml =
( annotation-xml.xhtml
| annotation-xml.svg
| epub.annotation-xml.mathml.content
| epub.annotation-xml.mathml.presentation
)
epub.annotation-xml.attributes = CommonAtt, cd?, src?
epub.annotation-xml.mathml.content =
element annotation-xml {
epub.annotation-xml.model.mathml.content, epub.annotation-xml.attributes,
epub.att-encoding.mathml.content, epub.att-name.mathml.content
}
epub.annotation-xml.model.mathml.content =
ContExp*
epub.att-encoding.mathml.content =
attribute encoding {
string "MathML-Content" | string "application/mathml-content+xml"
}
epub.att-name.mathml.content =
attribute name {
string "contentequiv"
}
epub.annotation-xml.mathml.presentation =
element annotation-xml {
epub.annotation-xml.model.mathml.presentation, epub.annotation-xml.attributes,
epub.att-encoding.mathml.presentation, epub.att-name.mathml.presentation?
}
epub.annotation-xml.model.mathml.presentation =
MathExpression*
epub.att-encoding.mathml.presentation =
attribute encoding {
string "MathML" | "MathML-Presentation" | string "application/mathml-presentation+xml"
}
epub.att-name.mathml.presentation =
attribute name {
xsd:NCName
}