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