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