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@0
|
43 |
(composition.file | composition.division)+
|
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@29
|
55 |
& xpath.attribute?
|
patrick@0
|
56 |
selection.id.attribute = attribute xml:id { xsd:ID }
|
patrick@0
|
57 |
|
patrick@0
|
58 |
selection.content =
|
patrick@20
|
59 |
selection.head?,
|
patrick@0
|
60 |
(selection.file | selection.division)+
|
patrick@0
|
61 |
|
patrick@0
|
62 |
|
patrick@0
|
63 |
# =============================================================================
|
patrick@20
|
64 |
# HEAD LEVEL
|
patrick@0
|
65 |
# =============================================================================
|
patrick@0
|
66 |
|
patrick@20
|
67 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
68 |
|
patrick@20
|
69 |
composition.head = element head { head.attributes, top.head.content }
|
patrick@20
|
70 |
selection.head = element head { top.head.content }
|
patrick@20
|
71 |
division.head = element head { division.head.content }
|
patrick@0
|
72 |
|
patrick@20
|
73 |
head.attributes =
|
patrick@0
|
74 |
remap.attributes
|
patrick@0
|
75 |
|
patrick@20
|
76 |
top.head.content =
|
patrick@18
|
77 |
(title, subtitle?)?
|
patrick@18
|
78 |
& language?
|
patrick@5
|
79 |
& author*
|
patrick@5
|
80 |
& publisher?
|
patrick@5
|
81 |
& source?
|
patrick@20
|
82 |
division.head.content =
|
patrick@20
|
83 |
(title, subtitle?)?
|
patrick@20
|
84 |
& language?
|
patrick@0
|
85 |
|
patrick@0
|
86 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
87 |
|
patrick@0
|
88 |
title = element title { title.content }
|
patrick@18
|
89 |
subtitle = element subtitle { title.content }
|
patrick@2
|
90 |
|
patrick@0
|
91 |
title.content = inlines
|
patrick@0
|
92 |
|
patrick@18
|
93 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@18
|
94 |
|
patrick@18
|
95 |
language = element language { language.attributes }
|
patrick@18
|
96 |
|
patrick@18
|
97 |
language.attributes = lang.attribute
|
patrick@18
|
98 |
lang.attribute = attribute xml:lang { xsd:language }
|
patrick@0
|
99 |
|
patrick@5
|
100 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@5
|
101 |
|
patrick@5
|
102 |
# ~~~~~~ author
|
patrick@5
|
103 |
author = element author { author.content }
|
patrick@5
|
104 |
|
patrick@5
|
105 |
author.content =
|
patrick@5
|
106 |
firstname?,
|
patrick@5
|
107 |
lastname
|
patrick@5
|
108 |
|
patrick@5
|
109 |
# ~~~~~~ publisher
|
patrick@5
|
110 |
publisher = element publisher { publisher.content }
|
patrick@5
|
111 |
|
patrick@5
|
112 |
publisher.content = inlines
|
patrick@5
|
113 |
|
patrick@5
|
114 |
# ~~~~~~ firstname
|
patrick@5
|
115 |
firstname = element firstname { firstname.content }
|
patrick@5
|
116 |
|
patrick@5
|
117 |
firstname.content = inlines
|
patrick@5
|
118 |
|
patrick@5
|
119 |
# ~~~~~~ lastname
|
patrick@5
|
120 |
lastname = element lastname { lastname.content }
|
patrick@5
|
121 |
|
patrick@5
|
122 |
lastname.content = inlines
|
patrick@5
|
123 |
|
patrick@0
|
124 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
125 |
|
patrick@2
|
126 |
# ~~~~~~ source
|
patrick@0
|
127 |
source = element source {
|
patrick@0
|
128 |
source.attributes,
|
patrick@0
|
129 |
( (attribute type { "book" }, source.content.book)
|
patrick@0
|
130 |
| (attribute type { "file" }))
|
patrick@0
|
131 |
}
|
patrick@0
|
132 |
|
patrick@0
|
133 |
source.attributes =
|
patrick@0
|
134 |
source.id.attribute?
|
patrick@0
|
135 |
& remap.attributes
|
patrick@0
|
136 |
source.id.attribute = attribute id { xsd:NMTOKEN }
|
patrick@0
|
137 |
|
patrick@0
|
138 |
source.content.book =
|
patrick@0
|
139 |
title?,
|
patrick@0
|
140 |
pagenumber?
|
patrick@0
|
141 |
|
patrick@2
|
142 |
# ~~~~~~ pagenumber
|
patrick@0
|
143 |
pagenumber = element pagenumber { pagenumber.attributes }
|
patrick@2
|
144 |
|
patrick@0
|
145 |
pagenumber.attributes =
|
patrick@0
|
146 |
pagenumber.value.attribute
|
patrick@0
|
147 |
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
|
patrick@0
|
148 |
pagenumber.value.enumeration = xsd:positiveInteger
|
patrick@0
|
149 |
|
patrick@0
|
150 |
|
patrick@0
|
151 |
# =============================================================================
|
patrick@20
|
152 |
# DIVISION LEVEL
|
patrick@0
|
153 |
# =============================================================================
|
patrick@0
|
154 |
|
patrick@0
|
155 |
composition.division = element division {
|
patrick@0
|
156 |
composition.division.attributes,
|
patrick@0
|
157 |
composition.division.content
|
patrick@0
|
158 |
}
|
patrick@0
|
159 |
selection.division = element division {
|
patrick@0
|
160 |
selection.division.attributes,
|
patrick@0
|
161 |
selection.division.content
|
patrick@0
|
162 |
}
|
patrick@0
|
163 |
|
patrick@0
|
164 |
composition.division.attributes =
|
patrick@26
|
165 |
path.attribute?
|
patrick@29
|
166 |
& xpath.attribute?
|
patrick@23
|
167 |
& xslt.attribute?
|
patrick@0
|
168 |
& remap.attributes
|
patrick@0
|
169 |
selection.division.attributes =
|
patrick@26
|
170 |
path.attribute?
|
patrick@29
|
171 |
& xpath.attribute?
|
patrick@0
|
172 |
|
patrick@0
|
173 |
composition.division.content =
|
patrick@20
|
174 |
composition.head?,
|
patrick@20
|
175 |
(composition.division | composition.file)+
|
patrick@0
|
176 |
selection.division.content =
|
patrick@20
|
177 |
selection.head?,
|
patrick@20
|
178 |
(selection.division | selection.file)+
|
patrick@0
|
179 |
|
patrick@0
|
180 |
|
patrick@0
|
181 |
# =============================================================================
|
patrick@20
|
182 |
# FILE LEVEL
|
patrick@0
|
183 |
# =============================================================================
|
patrick@0
|
184 |
|
patrick@0
|
185 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
186 |
|
patrick@2
|
187 |
composition.file = element file { composition.file.attributes, file.content }
|
patrick@2
|
188 |
selection.file = element file { selection.file.attributes, file.content }
|
patrick@0
|
189 |
|
patrick@0
|
190 |
composition.file.attributes =
|
patrick@29
|
191 |
xpath.attribute?
|
patrick@29
|
192 |
& xslt.attribute?
|
patrick@0
|
193 |
& remap.attributes
|
patrick@0
|
194 |
selection.file.attributes =
|
patrick@2
|
195 |
xpath.attribute?
|
patrick@0
|
196 |
|
patrick@2
|
197 |
file.content = xsd:anyURI
|
patrick@2
|
198 |
|
patrick@0
|
199 |
# =============================================================================
|
patrick@20
|
200 |
# INLINE LEVEL
|
patrick@0
|
201 |
# =============================================================================
|
patrick@0
|
202 |
|
patrick@0
|
203 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
204 |
|
patrick@0
|
205 |
inlines = mixed {
|
patrick@0
|
206 |
sup*
|
patrick@0
|
207 |
& sub*
|
patrick@0
|
208 |
}
|
patrick@0
|
209 |
|
patrick@0
|
210 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patrick@0
|
211 |
|
patrick@0
|
212 |
sup = element sup { inlines }
|
patrick@0
|
213 |
|
patrick@0
|
214 |
sub = element sub { inlines }
|
patrick@0
|
215 |
|
patrick@0
|
216 |
|
patrick@0
|
217 |
# =============================================================================
|
patrick@20
|
218 |
# REMAP ATTRIBUTES
|
patrick@0
|
219 |
# =============================================================================
|
patrick@0
|
220 |
|
patrick@0
|
221 |
remap.attributes =
|
patrick@0
|
222 |
as.attribute?
|
patrick@0
|
223 |
& attributes.attribute?
|
patrick@0
|
224 |
as.attribute = attribute as { xsd:QName }
|
patrick@0
|
225 |
attributes.attribute =
|
patrick@0
|
226 |
attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}
|