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