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 |
publiset.attributes =
|
patrick@0
|
12 |
version.attribute
|
patrick@0
|
13 |
version.attribute = attribute version { "1.0" }
|
patrick@0
|
14 |
|
patrick@0
|
15 |
publiset.content =
|
patrick@0
|
16 |
(composition | selection)+
|
patrick@0
|
17 |
|
patrick@0
|
18 |
|
patrick@0
|
19 |
# =============================================================================
|
patrick@20
|
20 |
# TOP LEVEL
|
patrick@0
|
21 |
# =============================================================================
|
patrick@0
|
22 |
|
patrick@0
|
23 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
24 |
|
patrick@0
|
25 |
composition = element composition {
|
patrick@0
|
26 |
composition.attributes,
|
patrick@0
|
27 |
composition.content
|
patrick@0
|
28 |
}
|
patrick@0
|
29 |
|
patrick@0
|
30 |
composition.attributes =
|
patrick@0
|
31 |
composition.id.attribute
|
patrick@29
|
32 |
& path.attribute?
|
patrick@29
|
33 |
& xpath.attribute?
|
patrick@29
|
34 |
& xslt.attribute?
|
patrick@0
|
35 |
& remap.attributes
|
patrick@0
|
36 |
composition.id.attribute = attribute xml:id { xsd:ID }
|
patrick@29
|
37 |
path.attribute = attribute path { xsd:anyURI }
|
patrick@29
|
38 |
xslt.attribute = attribute xslt { xsd:anyURI }
|
patrick@29
|
39 |
xpath.attribute = attribute xpath { text }
|
patrick@0
|
40 |
|
patrick@0
|
41 |
composition.content =
|
patrick@20
|
42 |
composition.head?,
|
patrick@30
|
43 |
(composition.division | composition.file)+
|
patrick@0
|
44 |
|
patrick@0
|
45 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
46 |
|
patrick@0
|
47 |
selection = element selection {
|
patrick@0
|
48 |
selection.attributes,
|
patrick@0
|
49 |
selection.content
|
patrick@0
|
50 |
}
|
patrick@0
|
51 |
|
patrick@0
|
52 |
selection.attributes =
|
patrick@29
|
53 |
selection.id.attribute
|
patrick@29
|
54 |
& path.attribute?
|
patrick@0
|
55 |
selection.id.attribute = attribute xml:id { xsd:ID }
|
patrick@0
|
56 |
|
patrick@0
|
57 |
selection.content =
|
patrick@20
|
58 |
selection.head?,
|
patrick@30
|
59 |
(selection.division | selection.file | link)+
|
patrick@0
|
60 |
|
patrick@0
|
61 |
|
patrick@0
|
62 |
# =============================================================================
|
patrick@20
|
63 |
# HEAD LEVEL
|
patrick@0
|
64 |
# =============================================================================
|
patrick@0
|
65 |
|
patrick@20
|
66 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
67 |
|
patrick@20
|
68 |
composition.head = element head { head.attributes, top.head.content }
|
patrick@20
|
69 |
selection.head = element head { top.head.content }
|
patrick@20
|
70 |
division.head = element head { division.head.content }
|
patrick@0
|
71 |
|
patrick@20
|
72 |
head.attributes =
|
patrick@0
|
73 |
remap.attributes
|
patrick@0
|
74 |
|
patrick@20
|
75 |
top.head.content =
|
patrick@18
|
76 |
(title, subtitle?)?
|
patrick@34
|
77 |
& identifier*
|
patrick@18
|
78 |
& language?
|
patrick@5
|
79 |
& author*
|
patrick@5
|
80 |
& publisher?
|
patrick@5
|
81 |
& source?
|
patrick@35
|
82 |
& cover?
|
patrick@20
|
83 |
division.head.content =
|
patrick@20
|
84 |
(title, subtitle?)?
|
patrick@20
|
85 |
& language?
|
patrick@0
|
86 |
|
patrick@0
|
87 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
88 |
|
patrick@0
|
89 |
title = element title { title.content }
|
patrick@18
|
90 |
subtitle = element subtitle { title.content }
|
patrick@2
|
91 |
|
patrick@0
|
92 |
title.content = inlines
|
patrick@0
|
93 |
|
patrick@34
|
94 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@34
|
95 |
|
patrick@38
|
96 |
identifier.uri = element identifier {
|
patrick@38
|
97 |
attribute type { "uri" }, xsd:anyURI
|
patrick@38
|
98 |
}
|
patrick@34
|
99 |
|
patrick@38
|
100 |
identifier.ean = element identifier {
|
patrick@38
|
101 |
attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
|
patrick@38
|
102 |
}
|
patrick@34
|
103 |
|
patrick@38
|
104 |
identifier = identifier.uri | identifier.ean
|
patrick@34
|
105 |
|
patrick@18
|
106 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@18
|
107 |
|
patrick@18
|
108 |
language = element language { language.attributes }
|
patrick@18
|
109 |
|
patrick@18
|
110 |
language.attributes = lang.attribute
|
patrick@18
|
111 |
lang.attribute = attribute xml:lang { xsd:language }
|
patrick@0
|
112 |
|
patrick@5
|
113 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@5
|
114 |
|
patrick@5
|
115 |
# ~~~~~~ author
|
patrick@5
|
116 |
author = element author { author.content }
|
patrick@5
|
117 |
|
patrick@34
|
118 |
author.attributes =
|
patrick@34
|
119 |
role.attribute?
|
patrick@34
|
120 |
role.attribute = attribute role { "author" | "illustrator" }
|
patrick@34
|
121 |
|
patrick@5
|
122 |
author.content =
|
patrick@5
|
123 |
firstname?,
|
patrick@34
|
124 |
lastname,
|
patrick@34
|
125 |
role*
|
patrick@5
|
126 |
|
patrick@5
|
127 |
# ~~~~~~ publisher
|
patrick@5
|
128 |
publisher = element publisher { publisher.content }
|
patrick@5
|
129 |
|
patrick@34
|
130 |
publisher.content =
|
patrick@34
|
131 |
label,
|
patrick@36
|
132 |
link?
|
patrick@5
|
133 |
|
patrick@5
|
134 |
# ~~~~~~ firstname
|
patrick@5
|
135 |
firstname = element firstname { firstname.content }
|
patrick@5
|
136 |
|
patrick@5
|
137 |
firstname.content = inlines
|
patrick@5
|
138 |
|
patrick@5
|
139 |
# ~~~~~~ lastname
|
patrick@5
|
140 |
lastname = element lastname { lastname.content }
|
patrick@5
|
141 |
|
patrick@5
|
142 |
lastname.content = inlines
|
patrick@5
|
143 |
|
patrick@34
|
144 |
# ~~~~~~ role
|
patrick@34
|
145 |
role = element role { role.attributes }
|
patrick@34
|
146 |
|
patrick@34
|
147 |
role.attributes =
|
patrick@34
|
148 |
role.of.attribute
|
patrick@34
|
149 |
role.of.attribute = attribute of { "author" | "illustrator" }
|
patrick@34
|
150 |
|
patrick@38
|
151 |
# ~~~~~~ label
|
patrick@38
|
152 |
label = element label { label.content }
|
patrick@38
|
153 |
|
patrick@38
|
154 |
label.content = inlines
|
patrick@38
|
155 |
|
patrick@0
|
156 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
157 |
|
patrick@2
|
158 |
# ~~~~~~ source
|
patrick@0
|
159 |
source = element source {
|
patrick@0
|
160 |
( (attribute type { "book" }, source.content.book)
|
patrick@38
|
161 |
| (attribute type { "file" }, source.content.file))
|
patrick@0
|
162 |
}
|
patrick@0
|
163 |
|
patrick@0
|
164 |
source.content.book =
|
patrick@38
|
165 |
identifier.ean,
|
patrick@0
|
166 |
title?,
|
patrick@38
|
167 |
pagenumber*
|
patrick@38
|
168 |
source.content.file =
|
patrick@38
|
169 |
identifier.uri
|
patrick@0
|
170 |
|
patrick@2
|
171 |
# ~~~~~~ pagenumber
|
patrick@0
|
172 |
pagenumber = element pagenumber { pagenumber.attributes }
|
patrick@2
|
173 |
|
patrick@0
|
174 |
pagenumber.attributes =
|
patrick@0
|
175 |
pagenumber.value.attribute
|
patrick@0
|
176 |
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
|
patrick@0
|
177 |
pagenumber.value.enumeration = xsd:positiveInteger
|
patrick@0
|
178 |
|
patrick@35
|
179 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@35
|
180 |
|
patrick@35
|
181 |
cover = element cover { cover.content }
|
patrick@35
|
182 |
|
patrick@35
|
183 |
cover.content =
|
patrick@35
|
184 |
cover.image
|
patrick@35
|
185 |
|
patrick@35
|
186 |
cover.image = element image { cover.image.attributes }
|
patrick@35
|
187 |
|
patrick@35
|
188 |
cover.image.attributes =
|
patrick@35
|
189 |
cover.image.id.attribute
|
patrick@35
|
190 |
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
|
patrick@35
|
191 |
|
patrick@0
|
192 |
|
patrick@0
|
193 |
# =============================================================================
|
patrick@20
|
194 |
# DIVISION LEVEL
|
patrick@0
|
195 |
# =============================================================================
|
patrick@0
|
196 |
|
patrick@0
|
197 |
composition.division = element division {
|
patrick@0
|
198 |
composition.division.attributes,
|
patrick@0
|
199 |
composition.division.content
|
patrick@0
|
200 |
}
|
patrick@0
|
201 |
selection.division = element division {
|
patrick@0
|
202 |
selection.division.attributes,
|
patrick@0
|
203 |
selection.division.content
|
patrick@0
|
204 |
}
|
patrick@0
|
205 |
|
patrick@0
|
206 |
composition.division.attributes =
|
patrick@26
|
207 |
path.attribute?
|
patrick@29
|
208 |
& xpath.attribute?
|
patrick@23
|
209 |
& xslt.attribute?
|
patrick@0
|
210 |
& remap.attributes
|
patrick@0
|
211 |
selection.division.attributes =
|
patrick@26
|
212 |
path.attribute?
|
patrick@0
|
213 |
|
patrick@0
|
214 |
composition.division.content =
|
patrick@20
|
215 |
composition.head?,
|
patrick@20
|
216 |
(composition.division | composition.file)+
|
patrick@0
|
217 |
selection.division.content =
|
patrick@20
|
218 |
selection.head?,
|
patrick@30
|
219 |
(selection.division | selection.file | link)+
|
patrick@0
|
220 |
|
patrick@0
|
221 |
|
patrick@0
|
222 |
# =============================================================================
|
patrick@20
|
223 |
# FILE LEVEL
|
patrick@0
|
224 |
# =============================================================================
|
patrick@0
|
225 |
|
patrick@0
|
226 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
227 |
|
patrick@30
|
228 |
composition.file = element file { composition.file.attributes }
|
patrick@2
|
229 |
selection.file = element file { selection.file.attributes, file.content }
|
patrick@0
|
230 |
|
patrick@0
|
231 |
composition.file.attributes =
|
patrick@30
|
232 |
name.attribute
|
patrick@30
|
233 |
& xpath.attribute?
|
patrick@29
|
234 |
& xslt.attribute?
|
patrick@0
|
235 |
& remap.attributes
|
patrick@0
|
236 |
selection.file.attributes =
|
patrick@30
|
237 |
name.attribute
|
patrick@30
|
238 |
& uri.attribute?
|
patrick@30
|
239 |
name.attribute = attribute name { xsd:anyURI }
|
patrick@0
|
240 |
|
patrick@30
|
241 |
file.content = inlines
|
patrick@30
|
242 |
|
patrick@30
|
243 |
|
patrick@0
|
244 |
# =============================================================================
|
patrick@20
|
245 |
# INLINE LEVEL
|
patrick@0
|
246 |
# =============================================================================
|
patrick@0
|
247 |
|
patrick@0
|
248 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
249 |
|
patrick@0
|
250 |
inlines = mixed {
|
patrick@0
|
251 |
sup*
|
patrick@0
|
252 |
& sub*
|
patrick@0
|
253 |
}
|
patrick@0
|
254 |
|
patrick@0
|
255 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
256 |
|
patrick@0
|
257 |
sup = element sup { inlines }
|
patrick@0
|
258 |
|
patrick@0
|
259 |
sub = element sub { inlines }
|
patrick@0
|
260 |
|
patrick@36
|
261 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@36
|
262 |
|
patrick@36
|
263 |
link = element link { link.attributes, link.content }
|
patrick@36
|
264 |
|
patrick@36
|
265 |
link.attributes =
|
patrick@36
|
266 |
uri.attribute
|
patrick@36
|
267 |
uri.attribute = attribute uri { xsd:anyURI }
|
patrick@36
|
268 |
|
patrick@36
|
269 |
link.content = inlines
|
patrick@36
|
270 |
|
patrick@0
|
271 |
|
patrick@0
|
272 |
# =============================================================================
|
patrick@20
|
273 |
# REMAP ATTRIBUTES
|
patrick@0
|
274 |
# =============================================================================
|
patrick@0
|
275 |
|
patrick@0
|
276 |
remap.attributes =
|
patrick@0
|
277 |
as.attribute?
|
patrick@0
|
278 |
& attributes.attribute?
|
patrick@0
|
279 |
as.attribute = attribute as { xsd:QName }
|
patrick@0
|
280 |
attributes.attribute =
|
patrick@0
|
281 |
attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}
|