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