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