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