patrick@0
|
1 |
# $Id$
|
patrick@0
|
2 |
|
patrick@0
|
3 |
start = publiset
|
patrick@0
|
4 |
|
patrick@0
|
5 |
|
patrick@0
|
6 |
publiset = element publiset {
|
patrick@0
|
7 |
publiset.attributes,
|
patrick@0
|
8 |
publiset.content
|
patrick@0
|
9 |
}
|
patrick@0
|
10 |
|
patrick@0
|
11 |
# ~~~~~~ attributes
|
patrick@0
|
12 |
publiset.attributes =
|
patrick@0
|
13 |
version.attribute
|
patrick@0
|
14 |
|
patrick@0
|
15 |
version.attribute = attribute version { "1.0" }
|
patrick@0
|
16 |
|
patrick@0
|
17 |
# ~~~~~~ content
|
patrick@0
|
18 |
publiset.content =
|
patrick@0
|
19 |
(composition | selection)+
|
patrick@0
|
20 |
|
patrick@0
|
21 |
|
patrick@0
|
22 |
# =============================================================================
|
patrick@0
|
23 |
# Top level
|
patrick@0
|
24 |
# =============================================================================
|
patrick@0
|
25 |
|
patrick@0
|
26 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
27 |
|
patrick@0
|
28 |
composition = element composition {
|
patrick@0
|
29 |
composition.attributes,
|
patrick@0
|
30 |
composition.content
|
patrick@0
|
31 |
}
|
patrick@0
|
32 |
|
patrick@0
|
33 |
# ~~~~~~ attributes
|
patrick@0
|
34 |
composition.attributes =
|
patrick@0
|
35 |
composition.id.attribute
|
patrick@0
|
36 |
& base.attribute?
|
patrick@0
|
37 |
& remap.attributes
|
patrick@0
|
38 |
|
patrick@0
|
39 |
composition.id.attribute = attribute xml:id { xsd:ID }
|
patrick@0
|
40 |
base.attribute = attribute xml:base { xsd:anyURI }
|
patrick@0
|
41 |
|
patrick@0
|
42 |
# ~~~~~~ content
|
patrick@0
|
43 |
composition.content =
|
patrick@0
|
44 |
composition.metadata?,
|
patrick@0
|
45 |
(composition.file | composition.division)+
|
patrick@0
|
46 |
|
patrick@0
|
47 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
48 |
|
patrick@0
|
49 |
selection = element selection {
|
patrick@0
|
50 |
selection.attributes,
|
patrick@0
|
51 |
selection.content
|
patrick@0
|
52 |
}
|
patrick@0
|
53 |
|
patrick@0
|
54 |
# ~~~~~~ attributes
|
patrick@0
|
55 |
selection.attributes =
|
patrick@0
|
56 |
base.attribute?
|
patrick@0
|
57 |
|
patrick@0
|
58 |
selection.id.attribute = attribute xml:id { xsd:ID }
|
patrick@0
|
59 |
|
patrick@0
|
60 |
# ~~~~~~ content
|
patrick@0
|
61 |
selection.content =
|
patrick@0
|
62 |
selection.metadata?,
|
patrick@0
|
63 |
(selection.file | selection.division)+
|
patrick@0
|
64 |
|
patrick@0
|
65 |
|
patrick@0
|
66 |
# =============================================================================
|
patrick@0
|
67 |
# Metadata level
|
patrick@0
|
68 |
# =============================================================================
|
patrick@0
|
69 |
|
patrick@0
|
70 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
71 |
|
patrick@0
|
72 |
composition.metadata = element metadata {
|
patrick@0
|
73 |
metadata.attributes,
|
patrick@0
|
74 |
metadata.content
|
patrick@0
|
75 |
}
|
patrick@0
|
76 |
|
patrick@0
|
77 |
selection.metadata = element metadata { metadata.content }
|
patrick@0
|
78 |
|
patrick@0
|
79 |
# ~~~~~~ attributes
|
patrick@0
|
80 |
metadata.attributes =
|
patrick@0
|
81 |
remap.attributes
|
patrick@0
|
82 |
|
patrick@0
|
83 |
# ~~~~~~ content
|
patrick@0
|
84 |
metadata.content =
|
patrick@0
|
85 |
title?,
|
patrick@0
|
86 |
subtitle?,
|
patrick@0
|
87 |
source?
|
patrick@0
|
88 |
|
patrick@0
|
89 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
90 |
|
patrick@0
|
91 |
title = element title { title.content }
|
patrick@0
|
92 |
title.content = inlines
|
patrick@0
|
93 |
|
patrick@0
|
94 |
subtitle = element subtitle { title.content }
|
patrick@0
|
95 |
|
patrick@0
|
96 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
97 |
|
patrick@0
|
98 |
source = element source {
|
patrick@0
|
99 |
source.attributes,
|
patrick@0
|
100 |
( (attribute type { "book" }, source.content.book)
|
patrick@0
|
101 |
| (attribute type { "file" }))
|
patrick@0
|
102 |
}
|
patrick@0
|
103 |
|
patrick@0
|
104 |
# ~~~~~~ Attributes
|
patrick@0
|
105 |
source.attributes =
|
patrick@0
|
106 |
source.id.attribute?
|
patrick@0
|
107 |
& remap.attributes
|
patrick@0
|
108 |
|
patrick@0
|
109 |
source.id.attribute = attribute id { xsd:NMTOKEN }
|
patrick@0
|
110 |
|
patrick@0
|
111 |
# ~~~~~~ Content
|
patrick@0
|
112 |
source.content.book =
|
patrick@0
|
113 |
title?,
|
patrick@0
|
114 |
pagenumber?
|
patrick@0
|
115 |
|
patrick@0
|
116 |
pagenumber = element pagenumber { pagenumber.attributes }
|
patrick@0
|
117 |
pagenumber.attributes =
|
patrick@0
|
118 |
pagenumber.value.attribute
|
patrick@0
|
119 |
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
|
patrick@0
|
120 |
pagenumber.value.enumeration = xsd:positiveInteger
|
patrick@0
|
121 |
|
patrick@0
|
122 |
|
patrick@0
|
123 |
# =============================================================================
|
patrick@0
|
124 |
# Division level
|
patrick@0
|
125 |
# =============================================================================
|
patrick@0
|
126 |
|
patrick@0
|
127 |
composition.division = element division {
|
patrick@0
|
128 |
composition.division.attributes,
|
patrick@0
|
129 |
composition.division.content
|
patrick@0
|
130 |
}
|
patrick@0
|
131 |
|
patrick@0
|
132 |
selection.division = element division {
|
patrick@0
|
133 |
selection.division.attributes,
|
patrick@0
|
134 |
selection.division.content
|
patrick@0
|
135 |
}
|
patrick@0
|
136 |
|
patrick@0
|
137 |
# ~~~~~~ attributes
|
patrick@0
|
138 |
composition.division.attributes =
|
patrick@0
|
139 |
base.attribute?
|
patrick@0
|
140 |
& remap.attributes
|
patrick@0
|
141 |
|
patrick@0
|
142 |
selection.division.attributes =
|
patrick@0
|
143 |
base.attribute?
|
patrick@0
|
144 |
|
patrick@0
|
145 |
# ~~~~~~ content
|
patrick@0
|
146 |
composition.division.content =
|
patrick@0
|
147 |
composition.metadata?,
|
patrick@0
|
148 |
(composition.file | composition.division)+
|
patrick@0
|
149 |
|
patrick@0
|
150 |
selection.division.content =
|
patrick@0
|
151 |
selection.metadata?,
|
patrick@0
|
152 |
(selection.file | selection.division)+
|
patrick@0
|
153 |
|
patrick@0
|
154 |
|
patrick@0
|
155 |
# =============================================================================
|
patrick@0
|
156 |
# File level
|
patrick@0
|
157 |
# =============================================================================
|
patrick@0
|
158 |
|
patrick@0
|
159 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
160 |
|
patrick@0
|
161 |
composition.file = element file { composition.file.attributes }
|
patrick@0
|
162 |
|
patrick@0
|
163 |
selection.file = element file { selection.file.attributes }
|
patrick@0
|
164 |
|
patrick@0
|
165 |
# ~~~~~~ attributes
|
patrick@0
|
166 |
composition.file.attributes =
|
patrick@0
|
167 |
name.attribute
|
patrick@0
|
168 |
& xpath.attribute?
|
patrick@0
|
169 |
& remap.attributes
|
patrick@0
|
170 |
|
patrick@0
|
171 |
selection.file.attributes =
|
patrick@0
|
172 |
name.attribute
|
patrick@0
|
173 |
& xpath.attribute?
|
patrick@0
|
174 |
|
patrick@0
|
175 |
name.attribute = attribute name { text }
|
patrick@0
|
176 |
xpath.attribute = attribute xpath { text }
|
patrick@0
|
177 |
|
patrick@0
|
178 |
|
patrick@0
|
179 |
# =============================================================================
|
patrick@0
|
180 |
# Inline level
|
patrick@0
|
181 |
# =============================================================================
|
patrick@0
|
182 |
|
patrick@0
|
183 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
184 |
|
patrick@0
|
185 |
inlines = mixed {
|
patrick@0
|
186 |
sup*
|
patrick@0
|
187 |
& sub*
|
patrick@0
|
188 |
}
|
patrick@0
|
189 |
|
patrick@0
|
190 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
191 |
|
patrick@0
|
192 |
sup = element sup { inlines }
|
patrick@0
|
193 |
|
patrick@0
|
194 |
sub = element sub { inlines }
|
patrick@0
|
195 |
|
patrick@0
|
196 |
|
patrick@0
|
197 |
# =============================================================================
|
patrick@0
|
198 |
# Remap attributes
|
patrick@0
|
199 |
# =============================================================================
|
patrick@0
|
200 |
|
patrick@0
|
201 |
remap.attributes =
|
patrick@0
|
202 |
as.attribute?
|
patrick@0
|
203 |
& attributes.attribute?
|
patrick@0
|
204 |
|
patrick@0
|
205 |
as.attribute = attribute as { xsd:QName }
|
patrick@0
|
206 |
attributes.attribute =
|
patrick@0
|
207 |
attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}
|