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