RelaxNG/publidoc.rnc
author Patrick PIERRE
mer., 08 mai 2013 09:12:05 +0200
changeset 206 e61680154e7d
parent 205 47aea917eaab
child 207 287bcc4b580c
permissions -rw-r--r--
Ajout de <warning>
patrick@0
     1
# $Id$
patrick@0
     2
patrick@0
     3
start = publidoc
patrick@0
     4
patrick@0
     5
patrick@0
     6
publidoc = element publidoc {
patrick@0
     7
   publidoc.attributes,
patrick@0
     8
   publidoc.content
patrick@0
     9
}
patrick@0
    10
patrick@0
    11
publidoc.attributes =
patrick@0
    12
   version.attribute
patrick@0
    13
version.attribute = attribute version { "1.0" }
patrick@0
    14
patrick@0
    15
publidoc.content =
patrick@0
    16
   document
patrick@0
    17
 | top.topic
patrick@0
    18
patrick@0
    19
patrick@0
    20
# =============================================================================
patrick@20
    21
#                                  TOP LEVEL
patrick@0
    22
# =============================================================================
patrick@0
    23
patrick@98
    24
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
    25
patrick@90
    26
top.head = element head { top.head.content }
patrick@90
    27
patrick@90
    28
top.head.content =
patrick@127
    29
   (title, shorttitle?, subtitle?)?
patrick@156
    30
 & (identifier, identifier?)?
patrick@181
    31
 & copyright*
Patrick@155
    32
 & collection?
patrick@90
    33
 & contributors?
patrick@90
    34
 & date?
patrick@90
    35
 & place?
patrick@156
    36
 & (source, source?)?
patrick@90
    37
 & keywordset?
patrick@90
    38
 & subjectset?
patrick@90
    39
 & abstract?
patrick@90
    40
 & cover?
patrick@90
    41
 & annotation*
patrick@90
    42
patrick@0
    43
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    44
patrick@90
    45
# ~~~~~~ document
patrick@0
    46
document = element document { document.attributes, document.content }
patrick@0
    47
patrick@0
    48
document.attributes =
patrick@0
    49
   document.id.attribute
patrick@142
    50
 & document.type.attribute?
patrick@66
    51
 & lang.attribute?
patrick@117
    52
document.id.attribute = attribute id { xsd:NMTOKEN }
patrick@142
    53
document.type.attribute = attribute type { xsd:NCName }
patrick@66
    54
lang.attribute = attribute xml:lang { xsd:language }
patrick@0
    55
patrick@0
    56
document.content =
patrick@20
    57
   top.head?,
patrick@56
    58
   (division | topic)+
patrick@0
    59
patrick@0
    60
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    61
patrick@18
    62
top.topic = element topic { top.topic.attributes, top.topic.content }
patrick@0
    63
patrick@20
    64
top.topic.attributes =
patrick@20
    65
   topic.id.attribute
patrick@20
    66
 & topic.type.attribute?
patrick@66
    67
 & lang.attribute?
patrick@117
    68
topic.id.attribute = attribute id { xsd:NMTOKEN }
patrick@20
    69
topic.type.attribute = attribute type { xsd:NCName }
patrick@20
    70
patrick@20
    71
top.topic.content =
patrick@20
    72
   top.head?,
Patrick@137
    73
   header?,
Patrick@190
    74
   ((section+, bibliography?) | bibliography),
Patrick@137
    75
   footer?
patrick@0
    76
patrick@40
    77
patrick@0
    78
# =============================================================================
patrick@20
    79
#                                 DIVISION LEVEL
patrick@0
    80
# =============================================================================
patrick@0
    81
patrick@70
    82
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    83
patrick@90
    84
# ~~~~~~ division
patrick@0
    85
division = element division { division.content }
patrick@0
    86
patrick@0
    87
division.content =
patrick@20
    88
   division.head?,
patrick@56
    89
   (division | topic)+
patrick@0
    90
patrick@90
    91
# ~~~~~~ division.head
patrick@90
    92
division.head = element head { division.head.content }
patrick@90
    93
patrick@90
    94
division.head.content =
patrick@127
    95
   (title, shorttitle?, subtitle?)?
patrick@90
    96
 & abstract?
patrick@90
    97
 & annotation*
patrick@90
    98
patrick@0
    99
patrick@0
   100
# =============================================================================
patrick@90
   101
#                                COMPONENT LEVEL
patrick@0
   102
# =============================================================================
patrick@0
   103
patrick@90
   104
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ component.head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   105
patrick@90
   106
component.head = element head { component.head.content }
patrick@90
   107
patrick@90
   108
component.head.content =
patrick@127
   109
   (title, shorttitle?, subtitle?)?
patrick@90
   110
 & contributors?
patrick@143
   111
 & date?
patrick@143
   112
 & place?
patrick@143
   113
 & keywordset?
patrick@143
   114
 & subjectset?
patrick@90
   115
 & abstract?
patrick@90
   116
 & annotation*
patrick@90
   117
patrick@0
   118
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   119
patrick@0
   120
topic = element topic { topic.attributes, topic.content }
patrick@0
   121
patrick@0
   122
topic.attributes =
Patrick@191
   123
   (topic.id.attribute | xmlid.attribute)?
patrick@0
   124
 & topic.type.attribute?
patrick@69
   125
 & lang.attribute?
Patrick@191
   126
xmlid.attribute = attribute xml:id { xsd:ID }
patrick@0
   127
patrick@0
   128
topic.content =
patrick@20
   129
   component.head?,
Patrick@137
   130
   header?,
Patrick@190
   131
   ((section+, bibliography?) | bibliography),
Patrick@137
   132
   footer?
patrick@0
   133
patrick@0
   134
patrick@0
   135
# =============================================================================
patrick@20
   136
#                                 SECTION LEVEL
patrick@0
   137
# =============================================================================
patrick@0
   138
Patrick@137
   139
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@137
   140
Patrick@137
   141
header = element header { header.content }
Patrick@137
   142
Patrick@137
   143
header.content =
Patrick@137
   144
   block+
Patrick@137
   145
patrick@20
   146
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   147
patrick@90
   148
# ~~~~~~ section
patrick@58
   149
section = element section { section.attributes, section.content }
patrick@58
   150
patrick@58
   151
section.attributes =
patrick@58
   152
   section.type.attribute?
patrick@64
   153
 & lang.attribute?
patrick@166
   154
 & for.attribute?
patrick@58
   155
section.type.attribute = attribute type { xsd:NCName }
patrick@166
   156
for.attribute = attribute for { xsd:NCName }
patrick@0
   157
patrick@0
   158
section.content =
patrick@20
   159
   section.head?,
patrick@9
   160
   (section+ | block+)
patrick@0
   161
patrick@90
   162
# ~~~~~~ section.head
patrick@90
   163
section.head = element head { section.head.content }
patrick@90
   164
patrick@90
   165
section.head.content =
patrick@127
   166
   (title, shorttitle?, subtitle?)?
Marc@177
   167
 & keywordset?
Marc@177
   168
 & subjectset?
patrick@90
   169
 & abstract?
patrick@105
   170
 & audio*
patrick@90
   171
 & annotation*
patrick@90
   172
Patrick@189
   173
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliography ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@189
   174
Patrick@189
   175
# ~~~~~~ bibliography
Patrick@189
   176
bibliography = element bibliography { bibliography.content }
Patrick@189
   177
Patrick@189
   178
bibliography.content =
Patrick@189
   179
   bibliography.entry+
Patrick@189
   180
Patrick@137
   181
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@137
   182
Patrick@137
   183
footer = element footer { footer.content }
Patrick@137
   184
Patrick@137
   185
footer.content =
Patrick@137
   186
   block+
Patrick@137
   187
patrick@0
   188
patrick@0
   189
# =============================================================================
patrick@20
   190
#                                 BLOCK LEVEL
patrick@0
   191
# =============================================================================
patrick@0
   192
patrick@20
   193
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   194
patrick@90
   195
# ~~~~~~ block
patrick@44
   196
block = (p | speech | \list | blockquote | table | media)
patrick@9
   197
patrick@90
   198
# ~~~~~~ block.head
patrick@90
   199
block.head = element head { block.head.content }
patrick@90
   200
patrick@90
   201
block.head.content =
patrick@127
   202
   (title, shorttitle?, subtitle?)?
patrick@90
   203
patrick@42
   204
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   205
patrick@20
   206
p = element p { p.content }
patrick@0
   207
patrick@20
   208
p.content =
patrick@0
   209
   inlines
patrick@0
   210
patrick@18
   211
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@18
   212
patrick@18
   213
# ~~~~~~ speech
patrick@18
   214
speech = element speech { speech.content }
patrick@18
   215
patrick@18
   216
speech.content =
patrick@18
   217
   speaker?,
patrick@18
   218
   stage?,
Patrick@199
   219
   (p | blockquote)+
patrick@18
   220
patrick@18
   221
# ~~~~~~ speaker
patrick@18
   222
speaker = element speaker { speaker.content }
patrick@18
   223
patrick@18
   224
speaker.content = inlines
patrick@18
   225
patrick@17
   226
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   227
patrick@9
   228
# ~~~~~~ list
patrick@75
   229
\list = element list {
patrick@20
   230
   block.head?,
patrick@71
   231
   (  (attribute type {"ordered"}?, item, item+)
patrick@9
   232
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   233
}
patrick@9
   234
patrick@9
   235
# ~~~~~~ item
patrick@9
   236
item = element item { item.content }
patrick@9
   237
patrick@30
   238
item.content =
patrick@73
   239
   inlines
patrick@73
   240
 | block+
patrick@9
   241
patrick@9
   242
# ~~~~~~ glossary.item
patrick@9
   243
glossary.item = element item { glossary.item.content }
patrick@9
   244
patrick@9
   245
glossary.item.content =
patrick@9
   246
   label,
patrick@9
   247
   block+
patrick@9
   248
patrick@44
   249
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@44
   250
patrick@44
   251
# ~~~~~~ blockquote
patrick@44
   252
blockquote = element blockquote { blockquote.content }
patrick@44
   253
patrick@44
   254
blockquote.content =
patrick@44
   255
   block.head?,
patrick@44
   256
   (p | speech | \list)+,
patrick@44
   257
   attribution?
patrick@44
   258
patrick@44
   259
# ~~~~~~ attribution
patrick@72
   260
attribution = element attribution { attribution.content }
patrick@44
   261
patrick@72
   262
attribution.content =
patrick@44
   263
   inlines
patrick@44
   264
patrick@17
   265
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@17
   266
patrick@73
   267
# ~~~~~~ table
patrick@17
   268
table = element table { table.content }
patrick@17
   269
patrick@17
   270
table.content =
patrick@20
   271
   block.head?,
patrick@17
   272
   tgroup+,
patrick@109
   273
   table.caption?
patrick@17
   274
patrick@17
   275
# ~~~~~~ tgroup
patrick@17
   276
tgroup = element tgroup { tgroup.attributes, tgroup.content }
patrick@17
   277
patrick@17
   278
tgroup.content =
patrick@17
   279
   thead?,
patrick@17
   280
   tbody
patrick@17
   281
patrick@17
   282
tgroup.attributes =
patrick@17
   283
   cols.attribute
patrick@17
   284
 & align.attribute?
patrick@17
   285
 & colsep.attribute?
patrick@17
   286
 & rowsep.attribute?
patrick@17
   287
cols.attribute = attribute cols { xsd:positiveInteger }
patrick@17
   288
align.attribute = attribute align { "left"  |  "right"  | "center" | "justify" }
patrick@17
   289
colsep.attribute = attribute colsep { "0" | "1" }
patrick@17
   290
rowsep.attribute = attribute rowsep { "0" | "1" }
patrick@17
   291
patrick@146
   292
# ~~~~~~ thead, tbody
patrick@22
   293
thead = element thead { thead.attributes, thead.content }
patrick@22
   294
tbody = element tbody { tbody.attributes, tbody.content }
patrick@17
   295
patrick@22
   296
thead.attributes =
patrick@22
   297
   valign.attribute?
patrick@22
   298
tbody.attributes =
patrick@22
   299
   valign.attribute?
patrick@22
   300
valign.attribute = attribute valign { "top" | "middle" | "bottom" }
patrick@75
   301
patrick@17
   302
thead.content =
patrick@17
   303
   row+
patrick@17
   304
tbody.content =
patrick@17
   305
   row+
patrick@17
   306
patrick@17
   307
# ~~~~~~ row
patrick@146
   308
row = element row { row.attributes, row.content }
patrick@17
   309
patrick@146
   310
row.attributes =
patrick@17
   311
   valign.attribute?
patrick@146
   312
 & rowsep.attribute?
patrick@17
   313
patrick@17
   314
row.content =
Patrick@189
   315
  table.entry+
patrick@17
   316
Patrick@189
   317
# ~~~~~~ table.entry
Patrick@189
   318
table.entry = element entry { table.entry.attributes, table.entry.content }
patrick@146
   319
Patrick@189
   320
table.entry.attributes =
patrick@146
   321
   align.attribute?
patrick@146
   322
 & valign.attribute?
patrick@146
   323
 & colsep.attribute?
patrick@146
   324
 & rowsep.attribute?
patrick@17
   325
Patrick@189
   326
table.entry.content =
patrick@17
   327
   inlines
patrick@37
   328
 | (p | media)+
patrick@17
   329
patrick@109
   330
# ~~~~~~ table.caption
patrick@109
   331
table.caption = element caption { caption.content }
patrick@17
   332
patrick@17
   333
caption.content =
patrick@20
   334
   inlines
Patrick@138
   335
 | (p | speech | \list | blockquote)+
patrick@17
   336
patrick@35
   337
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   338
patrick@2
   339
# ~~~~~~ media
patrick@0
   340
media = element media { media.content }
patrick@0
   341
patrick@0
   342
media.content =
patrick@24
   343
   block.head?,
patrick@119
   344
   (image | audio | video)+,
patrick@109
   345
   media.caption?,
patrick@36
   346
   link?
patrick@0
   347
patrick@2
   348
# ~~~~~~ image
patrick@0
   349
image = element image { image.attributes, image.content }
Patrick@191
   350
hotspot.image = element image {image.attributes }
patrick@0
   351
patrick@0
   352
image.attributes =
patrick@104
   353
   media.id.attribute
patrick@104
   354
 & image.type?
patrick@17
   355
media.id.attribute = attribute id { xsd:NMTOKEN }
Patrick@184
   356
image.type = attribute type { "cover" | "thumbnail" | "icon" | "animation" }
patrick@0
   357
patrick@0
   358
image.content =
patrick@111
   359
   copyright?,
Patrick@176
   360
   hotspot*
patrick@0
   361
patrick@45
   362
# ~~~~~~ audio
patrick@45
   363
audio = element audio { audio.attributes }
patrick@43
   364
patrick@45
   365
audio.attributes =
patrick@43
   366
   media.id.attribute
patrick@104
   367
 & audio.type?
patrick@113
   368
audio.type = attribute type { "music" | "voice" | "background" | "smil" }
patrick@43
   369
patrick@119
   370
# ~~~~~~ video
patrick@119
   371
video = element video { video.attributes }
patrick@119
   372
patrick@119
   373
video.attributes =
patrick@119
   374
   media.id.attribute
patrick@119
   375
patrick@122
   376
# ~~~~~~ hotspot
patrick@122
   377
hotspot = element hotspot { hotspot.attributes, hotspot.content }
patrick@122
   378
patrick@122
   379
hotspot.attributes =
patrick@122
   380
   x.attribute
patrick@122
   381
 & y.attribute
patrick@182
   382
 & w.attribute
Patrick@183
   383
 & h.attribute?
Patrick@191
   384
 & hotspot.type.attribute?
Patrick@191
   385
 & xmlid.attribute?
Patrick@173
   386
x.attribute = attribute x { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@173
   387
y.attribute = attribute y { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   388
w.attribute = attribute w { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   389
h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@183
   390
hotspot.type.attribute = attribute type { "normal" | "visible" | "pulse" }
Patrick@191
   391
   
Patrick@191
   392
hotspot.content =
Patrick@191
   393
   ((link | p+ | hotspot.image | audio | video), (spot, scenario?)?)
Patrick@191
   394
 | (spot, scenario?)
Patrick@191
   395
   
Patrick@191
   396
# ~~~~~~ spot
Patrick@191
   397
spot = element spot { spot.attributes, spot.content }
Patrick@191
   398
Patrick@191
   399
spot.attributes =
Patrick@191
   400
   dx.attribute?
Patrick@191
   401
 & dy.attribute?
Patrick@191
   402
 & dw.attribute?
Patrick@191
   403
 & dh.attribute?
patrick@188
   404
dx.attribute = attribute dx { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
patrick@188
   405
dy.attribute = attribute dy { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   406
dw.attribute = attribute dw { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   407
dh.attribute = attribute dh { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
Patrick@191
   408
Patrick@191
   409
spot.content =
Patrick@191
   410
   ((p+ | image), audio?)
Patrick@191
   411
 | audio
Patrick@191
   412
 | video
Patrick@191
   413
patrick@109
   414
# ~~~~~~ media.caption
patrick@109
   415
media.caption = element caption { caption.attributes, caption.content }
patrick@109
   416
patrick@109
   417
caption.attributes =
patrick@109
   418
   x.attribute?
patrick@109
   419
 & y.attribute?
patrick@109
   420
Patrick@191
   421
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ scenario ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@191
   422
Patrick@191
   423
# ~~~~~~ scenario
Patrick@191
   424
scenario = element scenario { scenario.content }
Patrick@191
   425
Patrick@191
   426
scenario.content =
Patrick@191
   427
   init*,
Patrick@191
   428
   onclick*
Patrick@191
   429
Patrick@191
   430
# ~~~~~~ init
Patrick@191
   431
init = element init { init.attributes }
Patrick@191
   432
Patrick@191
   433
init.attributes =
Patrick@191
   434
   init.action.attribute
Patrick@191
   435
 & target.attribute?
Patrick@191
   436
init.action.attribute = attribute action { "hide" }
Patrick@191
   437
target.attribute = attribute target { "hotspot" | "spot" }
Patrick@191
   438
Patrick@191
   439
# ~~~~~~ onclick
Patrick@191
   440
onclick = element onclick { onclick.attributes }
Patrick@191
   441
Patrick@191
   442
onclick.attributes =
Patrick@191
   443
   onclick.action.attribute
Patrick@191
   444
 & target.attribute?
Patrick@191
   445
onclick.action.attribute = attribute action { "show" }
Patrick@191
   446
Patrick@189
   447
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bibliograpgy.entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@189
   448
Patrick@189
   449
# ~~~~~~ bibliography.entry
Patrick@189
   450
bibliography.entry = element entry { bibliography.entry.content }
Patrick@189
   451
Patrick@189
   452
bibliography.entry.content =
Patrick@189
   453
   identifier.ean?
Patrick@189
   454
 & title
Patrick@189
   455
 & subtitle?
Patrick@189
   456
 & copyright?
Patrick@189
   457
 & collection?
Patrick@189
   458
 & contributors?
Patrick@189
   459
 & date?
Patrick@189
   460
 & place?
Patrick@189
   461
 & folio?
Patrick@189
   462
 & pages?
Patrick@189
   463
Patrick@189
   464
# ~~~~~~ folio
Patrick@189
   465
folio = element folio { folio.content }
Patrick@189
   466
Patrick@189
   467
folio.content = xsd:positiveInteger | xsd:token {pattern = "[DLXVI]+"}
Patrick@189
   468
Patrick@189
   469
# ~~~~~~ pages
Patrick@189
   470
pages = element pages { pages.content }
Patrick@189
   471
Patrick@189
   472
pages.content = xsd:positiveInteger
Patrick@189
   473
patrick@0
   474
patrick@0
   475
# =============================================================================
patrick@90
   476
#                                 HEAD LEVEL
patrick@90
   477
# =============================================================================
patrick@90
   478
patrick@127
   479
# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   480
patrick@90
   481
title = element title { title.content }
patrick@127
   482
shorttitle = element shorttitle { title.content }
patrick@90
   483
subtitle = element subtitle { title.content }
patrick@90
   484
patrick@90
   485
title.content = inlines
patrick@90
   486
patrick@90
   487
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   488
patrick@156
   489
identifier = element identifier {
patrick@156
   490
   (attribute type { "ean" }, xsd:token {pattern = "\d{13}"})
patrick@156
   491
 | (attribute type { "uri" }, xsd:anyURI)
patrick@90
   492
}
patrick@90
   493
patrick@90
   494
identifier.ean = element identifier {
patrick@90
   495
   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
patrick@90
   496
}
patrick@90
   497
patrick@156
   498
identifier.uri = element identifier {
patrick@156
   499
   attribute type { "uri" }, xsd:anyURI
patrick@156
   500
}
patrick@90
   501
patrick@90
   502
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   503
patrick@90
   504
copyright = element copyright { copyright.content }
patrick@90
   505
patrick@90
   506
copyright.content = inlines
patrick@90
   507
Patrick@155
   508
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@155
   509
Patrick@155
   510
collection = element collection { collection.content }
Patrick@155
   511
Patrick@155
   512
collection.content = inlines
Patrick@155
   513
patrick@90
   514
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   515
patrick@90
   516
# ~~~~~~ contributors
patrick@90
   517
contributors = element contributors { contributors.content }
patrick@90
   518
patrick@90
   519
contributors.content =
patrick@90
   520
   contributor+
patrick@90
   521
patrick@90
   522
# ~~~~~~ contributor
patrick@90
   523
contributor = element contributor { contributor.content }
patrick@90
   524
patrick@90
   525
contributor.content =
patrick@90
   526
   (((firstname, secondname?)?, lastname) | label),
patrick@90
   527
   address?,
patrick@90
   528
   link?,
patrick@101
   529
   role+
patrick@90
   530
patrick@90
   531
# ~~~~~~ firstname, secondname, lastname, label
patrick@90
   532
firstname = element firstname { firstname.content }
patrick@90
   533
secondname = element secondname { secondname.content }
patrick@90
   534
lastname = element lastname { lastname.content }
patrick@90
   535
label = element label { label.content }
patrick@90
   536
patrick@90
   537
firstname.content = inlines
patrick@90
   538
secondname.content = inlines
patrick@90
   539
lastname.content = inlines
patrick@90
   540
label.content = inlines
patrick@90
   541
patrick@90
   542
# ~~~~~~ address
patrick@90
   543
address = element address { address.content }
patrick@90
   544
patrick@90
   545
address.content = inlines
patrick@90
   546
patrick@90
   547
# ~~~~~~ role
patrick@90
   548
role = element role { role.content }
patrick@90
   549
patrick@90
   550
role.content = "author" | "illustrator" | "publisher" | "packager"
patrick@90
   551
patrick@90
   552
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   553
patrick@90
   554
place = element place { place.content }
patrick@90
   555
patrick@90
   556
place.content = inlines
patrick@90
   557
patrick@90
   558
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   559
patrick@90
   560
source = element source {
Patrick@189
   561
   (  (attribute type { "book" }, bibliography.entry.content)
patrick@90
   562
    | (attribute type { "file" }, source.content.file)),
patrick@90
   563
   source.content
patrick@90
   564
}
patrick@90
   565
patrick@90
   566
source.content.file =
patrick@90
   567
   identifier.uri
patrick@90
   568
source.content =
patrick@90
   569
   annotation*
patrick@90
   570
Patrick@189
   571
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   572
patrick@90
   573
# ~~~~~~ keywordset
patrick@90
   574
keywordset = element keywordset { keywordset.content }
patrick@90
   575
patrick@90
   576
keywordset.content = keyword+
patrick@90
   577
patrick@90
   578
# ~~~~~~ keyword
patrick@90
   579
keyword = element keyword { keyword.content }
patrick@90
   580
patrick@90
   581
keyword.content = mixed { sup*, sub* }
patrick@90
   582
patrick@90
   583
# ~~~~~~ subjectset
patrick@90
   584
subjectset = element subjectset { subjectset.content }
patrick@90
   585
patrick@90
   586
subjectset.content = subject+
patrick@90
   587
patrick@90
   588
# ~~~~~~ subject
patrick@132
   589
subject = element subject { subject.content }
patrick@90
   590
patrick@132
   591
subject.content = xsd:NMTOKEN
patrick@90
   592
patrick@90
   593
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   594
patrick@90
   595
abstract = element abstract { abstract.content }
patrick@90
   596
patrick@90
   597
abstract.content =
patrick@90
   598
   p+
patrick@90
   599
patrick@90
   600
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   601
patrick@90
   602
cover = element cover { cover.content }
patrick@90
   603
patrick@90
   604
cover.content =
patrick@90
   605
   cover.image
patrick@90
   606
patrick@90
   607
cover.image = element image { cover.image.attributes }
patrick@90
   608
patrick@90
   609
cover.image.attributes =
patrick@90
   610
   cover.image.id.attribute
patrick@90
   611
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
patrick@105
   612
   
patrick@90
   613
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   614
patrick@90
   615
annotation = element annotation { annotation.content }
patrick@90
   616
patrick@90
   617
annotation.content = inlines
patrick@90
   618
patrick@90
   619
patrick@90
   620
# =============================================================================
patrick@20
   621
#                                 INLINE LEVEL
patrick@0
   622
# =============================================================================
patrick@0
   623
patrick@0
   624
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   625
patrick@0
   626
inlines = mixed {
patrick@0
   627
   sup*
patrick@0
   628
 & sub*
patrick@42
   629
 & var*
patrick@13
   630
 & number*
patrick@42
   631
 & math*
patrick@0
   632
 & date*
patrick@0
   633
 & name*
patrick@5
   634
 & note*
patrick@0
   635
 & foreign*
patrick@0
   636
 & highlight*
patrick@5
   637
 & quote*
patrick@8
   638
 & acronym*
Patrick@140
   639
 & mentioned*
patrick@8
   640
 & term*
Patrick@185
   641
 & stage*
Patrick@140
   642
 & literal*
Patrick@185
   643
 & initial*
patrick@25
   644
 & link*
patrick@42
   645
 & anchor*
patrick@93
   646
 & image*
patrick@105
   647
 & smil*
Patrick@205
   648
 & warning*
patrick@0
   649
}
patrick@0
   650
patrick@42
   651
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   652
patrick@42
   653
sup = element sup { text }
patrick@0
   654
patrick@42
   655
sub = element sub { text }
patrick@42
   656
patrick@42
   657
var = element var { text }
patrick@42
   658
patrick@90
   659
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   660
patrick@90
   661
number = element number {
patrick@90
   662
   ( attribute type {"roman"}, number.attributes, number.roman.content )
patrick@90
   663
 | ( number.attributes, number.content)
patrick@90
   664
}
patrick@90
   665
patrick@90
   666
number.attributes =
patrick@90
   667
   number.value.attribute?
patrick@90
   668
number.value.attribute = attribute value { xsd:integer | xsd:decimal }
patrick@90
   669
patrick@90
   670
number.content = mixed { sup* }
patrick@157
   671
number.roman.content = xsd:token {pattern = "[DLXVI]+"}
patrick@90
   672
patrick@42
   673
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   674
patrick@42
   675
math = element math {
patrick@42
   676
   ( attribute notation {"tex"}, math.attributes, math.tex.content )
patrick@42
   677
 | ( math.attributes, math.content)
patrick@42
   678
}
patrick@42
   679
patrick@42
   680
math.attributes =
patrick@42
   681
   wide.attribute?
patrick@42
   682
wide.attribute = attribute wide { xsd:boolean }
patrick@42
   683
patrick@42
   684
math.content = mixed { sup* & sub* & var* }
patrick@42
   685
math.tex.content = text
patrick@0
   686
patrick@36
   687
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   688
patrick@0
   689
date = element date { date.attributes, date.content }
patrick@0
   690
patrick@3
   691
date.attributes =
patrick@13
   692
   date.value.attribute
patrick@13
   693
 & date.of.attribute?
patrick@13
   694
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
patrick@33
   695
date.of.attribute = attribute of { "birth" | "death" }
patrick@0
   696
patrick@13
   697
date.content = mixed { sup* }
patrick@0
   698
patrick@36
   699
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   700
patrick@0
   701
name = element name { name.attributes, name.content }
patrick@2
   702
patrick@2
   703
name.attributes =
patrick@2
   704
   name.of.attribute?
patrick@33
   705
name.of.attribute = attribute of
Patrick@135
   706
   { "person" | "company" | "book" | "newspaper" | "party" | "painting" }
patrick@0
   707
patrick@2
   708
name.content = inlines
patrick@2
   709
patrick@36
   710
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   711
patrick@5
   712
note = element note { note.attributes, note.content }
patrick@0
   713
patrick@5
   714
note.attributes =
patrick@5
   715
   note.label.attribute?
patrick@5
   716
note.label.attribute = attribute label { text }
patrick@0
   717
patrick@5
   718
note.content =
claire@180
   719
   (w?, block+) | inlines
patrick@91
   720
patrick@91
   721
w = element w { inlines }
patrick@0
   722
patrick@36
   723
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   724
patrick@0
   725
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   726
patrick@9
   727
foreign.attributes =
patrick@9
   728
   lang.attribute?
patrick@0
   729
patrick@0
   730
foreign.content = inlines
patrick@0
   731
patrick@36
   732
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   733
patrick@0
   734
highlight = element highlight { highlight.content }
patrick@0
   735
patrick@0
   736
highlight.content = inlines
patrick@0
   737
patrick@36
   738
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   739
patrick@5
   740
quote = element quote { quote.content }
patrick@5
   741
patrick@131
   742
quote.content =
patrick@131
   743
   (phrase, attribution) | inlines
patrick@131
   744
patrick@131
   745
phrase = element phrase { phrase.content }
patrick@131
   746
patrick@131
   747
phrase.content = inlines
patrick@5
   748
patrick@36
   749
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   750
patrick@8
   751
acronym = element acronym { acronym.content }
patrick@8
   752
patrick@8
   753
acronym.content = inlines
patrick@8
   754
Patrick@140
   755
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@140
   756
Patrick@140
   757
mentioned = element mentioned { mentioned.content }
Patrick@140
   758
Patrick@140
   759
mentioned.content = inlines
Patrick@140
   760
patrick@36
   761
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   762
patrick@8
   763
term = element term { term.content }
patrick@8
   764
patrick@8
   765
term.content = inlines
patrick@8
   766
Patrick@185
   767
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@185
   768
Patrick@185
   769
stage = element stage { stage.content }
Patrick@185
   770
Patrick@185
   771
stage.content = inlines
Patrick@185
   772
Patrick@140
   773
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ literal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@140
   774
Patrick@140
   775
literal = element literal { literal.content }
Patrick@140
   776
Patrick@140
   777
literal.content = text
Patrick@140
   778
Patrick@185
   779
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ initial ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@185
   780
Patrick@185
   781
initial = element initial { initial.content }
Patrick@185
   782
Patrick@185
   783
initial.content =
Patrick@185
   784
   c,
Patrick@185
   785
   w?
Patrick@185
   786
Patrick@185
   787
c = element c { text }
Patrick@185
   788
patrick@36
   789
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   790
patrick@0
   791
link = element link { link.attributes, link.content }
patrick@0
   792
patrick@9
   793
link.attributes =
patrick@42
   794
   (uri.attribute | idref.attribute)
patrick@9
   795
uri.attribute = attribute uri { xsd:anyURI }
patrick@9
   796
idref.attribute = attribute idref { xsd:IDREF }
patrick@0
   797
patrick@0
   798
link.content = inlines
patrick@42
   799
patrick@42
   800
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   801
Patrick@147
   802
anchor = element anchor { anchor.attributes, anchor.content }
patrick@42
   803
patrick@42
   804
anchor.attributes =
patrick@42
   805
   anchor.id.attribute
patrick@42
   806
anchor.id.attribute = attribute xml:id { xsd:ID }
patrick@91
   807
Patrick@147
   808
anchor.content = inlines
Patrick@147
   809
patrick@105
   810
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@105
   811
patrick@105
   812
smil = element smil { smil.attributes, smil.content }
patrick@105
   813
patrick@105
   814
smil.attributes =
patrick@105
   815
   begin.attribute?
patrick@105
   816
 & end.attribute?
patrick@105
   817
begin.attribute = attribute begin { xsd:decimal }
patrick@105
   818
end.attribute = attribute end { xsd:decimal }
patrick@105
   819
patrick@105
   820
smil.content = inlines
Patrick@205
   821
Patrick@205
   822
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@205
   823
Patrick@205
   824
warning = element warning { warning.content }
Patrick@205
   825
Patrick@205
   826
warning.content = inlines