RelaxNG/publidoc.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
sam., 06 avril 2013 14:17:18 +0200
changeset 188 b9fea8bd2412
parent 185 2a8ac62f00d3
child 189 951f1a25efc5
permissions -rw-r--r--
dx avec %
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@181
    31
 & copyright*
Patrick@155
    32
 & collection?
patrick@90
    33
 & contributors?
patrick@90
    34
 & date?
patrick@90
    35
 & place?
patrick@156
    36
 & (source, source?)?
patrick@90
    37
 & keywordset?
patrick@90
    38
 & subjectset?
patrick@90
    39
 & abstract?
patrick@90
    40
 & cover?
patrick@90
    41
 & annotation*
patrick@90
    42
patrick@0
    43
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    44
patrick@90
    45
# ~~~~~~ document
patrick@0
    46
document = element document { document.attributes, document.content }
patrick@0
    47
patrick@0
    48
document.attributes =
patrick@0
    49
   document.id.attribute
patrick@142
    50
 & document.type.attribute?
patrick@66
    51
 & lang.attribute?
patrick@117
    52
document.id.attribute = attribute id { xsd:NMTOKEN }
patrick@142
    53
document.type.attribute = attribute type { xsd:NCName }
patrick@66
    54
lang.attribute = attribute xml:lang { xsd:language }
patrick@0
    55
patrick@0
    56
document.content =
patrick@20
    57
   top.head?,
patrick@56
    58
   (division | topic)+
patrick@0
    59
patrick@0
    60
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    61
patrick@18
    62
top.topic = element topic { top.topic.attributes, top.topic.content }
patrick@0
    63
patrick@20
    64
top.topic.attributes =
patrick@20
    65
   topic.id.attribute
patrick@20
    66
 & topic.type.attribute?
patrick@66
    67
 & lang.attribute?
patrick@117
    68
topic.id.attribute = attribute id { xsd:NMTOKEN }
patrick@20
    69
topic.type.attribute = attribute type { xsd:NCName }
patrick@20
    70
patrick@20
    71
top.topic.content =
patrick@20
    72
   top.head?,
Patrick@137
    73
   header?,
Patrick@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@166
   154
 & for.attribute?
patrick@58
   155
section.type.attribute = attribute type { xsd:NCName }
patrick@166
   156
for.attribute = attribute for { xsd:NCName }
patrick@0
   157
patrick@0
   158
section.content =
patrick@20
   159
   section.head?,
patrick@9
   160
   (section+ | block+)
patrick@0
   161
patrick@90
   162
# ~~~~~~ section.head
patrick@90
   163
section.head = element head { section.head.content }
patrick@90
   164
patrick@90
   165
section.head.content =
patrick@127
   166
   (title, shorttitle?, subtitle?)?
Marc@177
   167
 & keywordset?
Marc@177
   168
 & subjectset?
patrick@90
   169
 & abstract?
patrick@105
   170
 & audio*
patrick@90
   171
 & annotation*
patrick@90
   172
Patrick@137
   173
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@137
   174
Patrick@137
   175
footer = element footer { footer.content }
Patrick@137
   176
Patrick@137
   177
footer.content =
Patrick@137
   178
   block+
Patrick@137
   179
patrick@0
   180
patrick@0
   181
# =============================================================================
patrick@20
   182
#                                 BLOCK LEVEL
patrick@0
   183
# =============================================================================
patrick@0
   184
patrick@20
   185
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@9
   186
patrick@90
   187
# ~~~~~~ block
patrick@44
   188
block = (p | speech | \list | blockquote | table | media)
patrick@9
   189
patrick@90
   190
# ~~~~~~ block.head
patrick@90
   191
block.head = element head { block.head.content }
patrick@90
   192
patrick@90
   193
block.head.content =
patrick@127
   194
   (title, shorttitle?, subtitle?)?
patrick@90
   195
patrick@42
   196
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   197
patrick@20
   198
p = element p { p.content }
patrick@0
   199
patrick@20
   200
p.content =
patrick@0
   201
   inlines
patrick@0
   202
patrick@18
   203
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@18
   204
patrick@18
   205
# ~~~~~~ speech
patrick@18
   206
speech = element speech { speech.content }
patrick@18
   207
patrick@18
   208
speech.content =
patrick@18
   209
   speaker?,
patrick@18
   210
   stage?,
patrick@20
   211
   p+
patrick@18
   212
patrick@18
   213
# ~~~~~~ speaker
patrick@18
   214
speaker = element speaker { speaker.content }
patrick@18
   215
patrick@18
   216
speaker.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@184
   347
image.type = attribute type { "cover" | "thumbnail" | "icon" | "animation" }
patrick@0
   348
patrick@0
   349
image.content =
patrick@111
   350
   copyright?,
Patrick@176
   351
   hotspot*
patrick@0
   352
patrick@45
   353
# ~~~~~~ audio
patrick@45
   354
audio = element audio { audio.attributes }
patrick@43
   355
patrick@45
   356
audio.attributes =
patrick@43
   357
   media.id.attribute
patrick@104
   358
 & audio.type?
patrick@113
   359
audio.type = attribute type { "music" | "voice" | "background" | "smil" }
patrick@43
   360
patrick@119
   361
# ~~~~~~ video
patrick@119
   362
video = element video { video.attributes }
patrick@119
   363
patrick@119
   364
video.attributes =
patrick@119
   365
   media.id.attribute
patrick@119
   366
patrick@122
   367
# ~~~~~~ hotspot
patrick@122
   368
hotspot = element hotspot { hotspot.attributes, hotspot.content }
patrick@122
   369
patrick@122
   370
hotspot.attributes =
patrick@122
   371
   x.attribute
patrick@122
   372
 & y.attribute
patrick@182
   373
 & w.attribute
Patrick@183
   374
 & h.attribute?
Patrick@183
   375
 & (hotspot.type.attribute
Patrick@183
   376
  & dx.attribute?
Patrick@183
   377
  & dy.attribute?
Patrick@183
   378
  & dw.attribute?
Patrick@183
   379
  & dh.attribute?)?
Patrick@173
   380
x.attribute = attribute x { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@173
   381
y.attribute = attribute y { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   382
w.attribute = attribute w { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@182
   383
h.attribute = attribute h { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@183
   384
hotspot.type.attribute = attribute type { "normal" | "visible" | "pulse" }
patrick@188
   385
dx.attribute = attribute dx { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
patrick@188
   386
dy.attribute = attribute dy { xsd:token {pattern = "-?\d{1,2}(\.\d{1,2})?%"} }
patrick@188
   387
dw.attribute = attribute dw { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
patrick@188
   388
dh.attribute = attribute dh { xsd:token {pattern = "\d{1,2}(\.\d{1,2})?%"} }
Patrick@176
   389
   
patrick@122
   390
hotspot.content =
Patrick@183
   391
   (p | link | image | audio | video),
Patrick@183
   392
   scenario?
patrick@109
   393
   
patrick@109
   394
# ~~~~~~ media.caption
patrick@109
   395
media.caption = element caption { caption.attributes, caption.content }
patrick@109
   396
patrick@109
   397
caption.attributes =
patrick@109
   398
   x.attribute?
patrick@109
   399
 & y.attribute?
patrick@109
   400
Patrick@183
   401
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ scenario ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@183
   402
Patrick@183
   403
# ~~~~~~ scenario
Patrick@183
   404
scenario = element scenario { scenario.content }
Patrick@183
   405
Patrick@183
   406
scenario.content =
Patrick@183
   407
   init*,
Patrick@183
   408
   onclick*
Patrick@183
   409
Patrick@183
   410
# ~~~~~~ init
Patrick@183
   411
init = element init { init.attributes }
Patrick@183
   412
Patrick@183
   413
init.attributes =
Patrick@183
   414
   init.action.attribute
Patrick@183
   415
init.action.attribute = attribute action { "hide" }
Patrick@183
   416
Patrick@183
   417
# ~~~~~~ onclick
Patrick@183
   418
onclick = element onclick { onclick.attributes }
Patrick@183
   419
Patrick@183
   420
onclick.attributes =
Patrick@183
   421
   onclick.action.attribute
Patrick@183
   422
onclick.action.attribute = attribute action { "show" }
Patrick@183
   423
patrick@0
   424
patrick@0
   425
# =============================================================================
patrick@90
   426
#                                 HEAD LEVEL
patrick@90
   427
# =============================================================================
patrick@90
   428
patrick@127
   429
# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   430
patrick@90
   431
title = element title { title.content }
patrick@127
   432
shorttitle = element shorttitle { title.content }
patrick@90
   433
subtitle = element subtitle { title.content }
patrick@90
   434
patrick@90
   435
title.content = inlines
patrick@90
   436
patrick@90
   437
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   438
patrick@156
   439
identifier = element identifier {
patrick@156
   440
   (attribute type { "ean" }, xsd:token {pattern = "\d{13}"})
patrick@156
   441
 | (attribute type { "uri" }, xsd:anyURI)
patrick@90
   442
}
patrick@90
   443
patrick@90
   444
identifier.ean = element identifier {
patrick@90
   445
   attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
patrick@90
   446
}
patrick@90
   447
patrick@156
   448
identifier.uri = element identifier {
patrick@156
   449
   attribute type { "uri" }, xsd:anyURI
patrick@156
   450
}
patrick@90
   451
patrick@90
   452
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   453
patrick@90
   454
copyright = element copyright { copyright.content }
patrick@90
   455
patrick@90
   456
copyright.content = inlines
patrick@90
   457
Patrick@155
   458
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@155
   459
Patrick@155
   460
collection = element collection { collection.content }
Patrick@155
   461
Patrick@155
   462
collection.content = inlines
Patrick@155
   463
patrick@90
   464
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   465
patrick@90
   466
# ~~~~~~ contributors
patrick@90
   467
contributors = element contributors { contributors.content }
patrick@90
   468
patrick@90
   469
contributors.content =
patrick@90
   470
   contributor+
patrick@90
   471
patrick@90
   472
# ~~~~~~ contributor
patrick@90
   473
contributor = element contributor { contributor.content }
patrick@90
   474
patrick@90
   475
contributor.content =
patrick@90
   476
   (((firstname, secondname?)?, lastname) | label),
patrick@90
   477
   address?,
patrick@90
   478
   link?,
patrick@101
   479
   role+
patrick@90
   480
patrick@90
   481
# ~~~~~~ firstname, secondname, lastname, label
patrick@90
   482
firstname = element firstname { firstname.content }
patrick@90
   483
secondname = element secondname { secondname.content }
patrick@90
   484
lastname = element lastname { lastname.content }
patrick@90
   485
label = element label { label.content }
patrick@90
   486
patrick@90
   487
firstname.content = inlines
patrick@90
   488
secondname.content = inlines
patrick@90
   489
lastname.content = inlines
patrick@90
   490
label.content = inlines
patrick@90
   491
patrick@90
   492
# ~~~~~~ address
patrick@90
   493
address = element address { address.content }
patrick@90
   494
patrick@90
   495
address.content = inlines
patrick@90
   496
patrick@90
   497
# ~~~~~~ role
patrick@90
   498
role = element role { role.content }
patrick@90
   499
patrick@90
   500
role.content = "author" | "illustrator" | "publisher" | "packager"
patrick@90
   501
patrick@90
   502
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   503
patrick@90
   504
place = element place { place.content }
patrick@90
   505
patrick@90
   506
place.content = inlines
patrick@90
   507
patrick@90
   508
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   509
patrick@90
   510
# ~~~~~~ source
patrick@90
   511
source = element source {
patrick@90
   512
   (  (attribute type { "book" }, source.content.book)
patrick@90
   513
    | (attribute type { "file" }, source.content.file)),
patrick@90
   514
   source.content
patrick@90
   515
}
patrick@90
   516
patrick@90
   517
source.content.book =
patrick@90
   518
   identifier.ean,
patrick@90
   519
   title?,
patrick@90
   520
   pagenumber*
patrick@90
   521
source.content.file =
patrick@90
   522
   identifier.uri
patrick@90
   523
source.content =
patrick@90
   524
   annotation*
patrick@90
   525
patrick@90
   526
# ~~~~~~ pagenumber
patrick@90
   527
pagenumber = element pagenumber { pagenumber.content }
patrick@90
   528
patrick@90
   529
pagenumber.content = xsd:positiveInteger
patrick@90
   530
patrick@132
   531
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   532
patrick@90
   533
# ~~~~~~ keywordset
patrick@90
   534
keywordset = element keywordset { keywordset.content }
patrick@90
   535
patrick@90
   536
keywordset.content = keyword+
patrick@90
   537
patrick@90
   538
# ~~~~~~ keyword
patrick@90
   539
keyword = element keyword { keyword.content }
patrick@90
   540
patrick@90
   541
keyword.content = mixed { sup*, sub* }
patrick@90
   542
patrick@90
   543
# ~~~~~~ subjectset
patrick@90
   544
subjectset = element subjectset { subjectset.content }
patrick@90
   545
patrick@90
   546
subjectset.content = subject+
patrick@90
   547
patrick@90
   548
# ~~~~~~ subject
patrick@132
   549
subject = element subject { subject.content }
patrick@90
   550
patrick@132
   551
subject.content = xsd:NMTOKEN
patrick@90
   552
patrick@90
   553
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   554
patrick@90
   555
abstract = element abstract { abstract.content }
patrick@90
   556
patrick@90
   557
abstract.content =
patrick@90
   558
   p+
patrick@90
   559
patrick@90
   560
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   561
patrick@90
   562
cover = element cover { cover.content }
patrick@90
   563
patrick@90
   564
cover.content =
patrick@90
   565
   cover.image
patrick@90
   566
patrick@90
   567
cover.image = element image { cover.image.attributes }
patrick@90
   568
patrick@90
   569
cover.image.attributes =
patrick@90
   570
   cover.image.id.attribute
patrick@90
   571
cover.image.id.attribute = attribute id { xsd:NMTOKEN }
patrick@105
   572
   
patrick@90
   573
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   574
patrick@90
   575
annotation = element annotation { annotation.content }
patrick@90
   576
patrick@90
   577
annotation.content = inlines
patrick@90
   578
patrick@90
   579
patrick@90
   580
# =============================================================================
patrick@20
   581
#                                 INLINE LEVEL
patrick@0
   582
# =============================================================================
patrick@0
   583
patrick@0
   584
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   585
patrick@0
   586
inlines = mixed {
patrick@0
   587
   sup*
patrick@0
   588
 & sub*
patrick@42
   589
 & var*
patrick@13
   590
 & number*
patrick@42
   591
 & math*
patrick@0
   592
 & date*
patrick@0
   593
 & name*
patrick@5
   594
 & note*
patrick@0
   595
 & foreign*
patrick@0
   596
 & highlight*
patrick@5
   597
 & quote*
patrick@8
   598
 & acronym*
Patrick@140
   599
 & mentioned*
patrick@8
   600
 & term*
Patrick@185
   601
 & stage*
Patrick@140
   602
 & literal*
Patrick@185
   603
 & initial*
patrick@25
   604
 & link*
patrick@42
   605
 & anchor*
patrick@93
   606
 & image*
patrick@105
   607
 & smil*
patrick@0
   608
}
patrick@0
   609
patrick@42
   610
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup, var ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   611
patrick@42
   612
sup = element sup { text }
patrick@0
   613
patrick@42
   614
sub = element sub { text }
patrick@42
   615
patrick@42
   616
var = element var { text }
patrick@42
   617
patrick@90
   618
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@90
   619
patrick@90
   620
number = element number {
patrick@90
   621
   ( attribute type {"roman"}, number.attributes, number.roman.content )
patrick@90
   622
 | ( number.attributes, number.content)
patrick@90
   623
}
patrick@90
   624
patrick@90
   625
number.attributes =
patrick@90
   626
   number.value.attribute?
patrick@90
   627
number.value.attribute = attribute value { xsd:integer | xsd:decimal }
patrick@90
   628
patrick@90
   629
number.content = mixed { sup* }
patrick@157
   630
number.roman.content = xsd:token {pattern = "[DLXVI]+"}
patrick@90
   631
patrick@42
   632
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ math ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   633
patrick@42
   634
math = element math {
patrick@42
   635
   ( attribute notation {"tex"}, math.attributes, math.tex.content )
patrick@42
   636
 | ( math.attributes, math.content)
patrick@42
   637
}
patrick@42
   638
patrick@42
   639
math.attributes =
patrick@42
   640
   wide.attribute?
patrick@42
   641
wide.attribute = attribute wide { xsd:boolean }
patrick@42
   642
patrick@42
   643
math.content = mixed { sup* & sub* & var* }
patrick@42
   644
math.tex.content = text
patrick@0
   645
patrick@36
   646
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   647
patrick@0
   648
date = element date { date.attributes, date.content }
patrick@0
   649
patrick@3
   650
date.attributes =
patrick@13
   651
   date.value.attribute
patrick@13
   652
 & date.of.attribute?
patrick@13
   653
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
patrick@33
   654
date.of.attribute = attribute of { "birth" | "death" }
patrick@0
   655
patrick@13
   656
date.content = mixed { sup* }
patrick@0
   657
patrick@36
   658
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   659
patrick@0
   660
name = element name { name.attributes, name.content }
patrick@2
   661
patrick@2
   662
name.attributes =
patrick@2
   663
   name.of.attribute?
patrick@33
   664
name.of.attribute = attribute of
Patrick@135
   665
   { "person" | "company" | "book" | "newspaper" | "party" | "painting" }
patrick@0
   666
patrick@2
   667
name.content = inlines
patrick@2
   668
patrick@36
   669
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   670
patrick@5
   671
note = element note { note.attributes, note.content }
patrick@0
   672
patrick@5
   673
note.attributes =
patrick@5
   674
   note.label.attribute?
patrick@5
   675
note.label.attribute = attribute label { text }
patrick@0
   676
patrick@5
   677
note.content =
claire@180
   678
   (w?, block+) | inlines
patrick@91
   679
patrick@91
   680
w = element w { inlines }
patrick@0
   681
patrick@36
   682
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   683
patrick@0
   684
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   685
patrick@9
   686
foreign.attributes =
patrick@9
   687
   lang.attribute?
patrick@0
   688
patrick@0
   689
foreign.content = inlines
patrick@0
   690
patrick@36
   691
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   692
patrick@0
   693
highlight = element highlight { highlight.content }
patrick@0
   694
patrick@0
   695
highlight.content = inlines
patrick@0
   696
patrick@36
   697
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   698
patrick@5
   699
quote = element quote { quote.content }
patrick@5
   700
patrick@131
   701
quote.content =
patrick@131
   702
   (phrase, attribution) | inlines
patrick@131
   703
patrick@131
   704
phrase = element phrase { phrase.content }
patrick@131
   705
patrick@131
   706
phrase.content = inlines
patrick@5
   707
patrick@36
   708
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   709
patrick@8
   710
acronym = element acronym { acronym.content }
patrick@8
   711
patrick@8
   712
acronym.content = inlines
patrick@8
   713
Patrick@140
   714
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@140
   715
Patrick@140
   716
mentioned = element mentioned { mentioned.content }
Patrick@140
   717
Patrick@140
   718
mentioned.content = inlines
Patrick@140
   719
patrick@36
   720
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   721
patrick@8
   722
term = element term { term.content }
patrick@8
   723
patrick@8
   724
term.content = inlines
patrick@8
   725
Patrick@185
   726
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@185
   727
Patrick@185
   728
stage = element stage { stage.content }
Patrick@185
   729
Patrick@185
   730
stage.content = inlines
Patrick@185
   731
Patrick@140
   732
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ literal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@140
   733
Patrick@140
   734
literal = element literal { literal.content }
Patrick@140
   735
Patrick@140
   736
literal.content = text
Patrick@140
   737
Patrick@185
   738
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ initial ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@185
   739
Patrick@185
   740
initial = element initial { initial.content }
Patrick@185
   741
Patrick@185
   742
initial.content =
Patrick@185
   743
   c,
Patrick@185
   744
   w?
Patrick@185
   745
Patrick@185
   746
c = element c { text }
Patrick@185
   747
patrick@36
   748
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   749
patrick@0
   750
link = element link { link.attributes, link.content }
patrick@0
   751
patrick@9
   752
link.attributes =
patrick@42
   753
   (uri.attribute | idref.attribute)
patrick@9
   754
uri.attribute = attribute uri { xsd:anyURI }
patrick@9
   755
idref.attribute = attribute idref { xsd:IDREF }
patrick@0
   756
patrick@0
   757
link.content = inlines
patrick@42
   758
patrick@42
   759
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@42
   760
Patrick@147
   761
anchor = element anchor { anchor.attributes, anchor.content }
patrick@42
   762
patrick@42
   763
anchor.attributes =
patrick@42
   764
   anchor.id.attribute
patrick@42
   765
anchor.id.attribute = attribute xml:id { xsd:ID }
patrick@91
   766
Patrick@147
   767
anchor.content = inlines
Patrick@147
   768
patrick@105
   769
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@105
   770
patrick@105
   771
smil = element smil { smil.attributes, smil.content }
patrick@105
   772
patrick@105
   773
smil.attributes =
patrick@105
   774
   begin.attribute?
patrick@105
   775
 & end.attribute?
patrick@105
   776
begin.attribute = attribute begin { xsd:decimal }
patrick@105
   777
end.attribute = attribute end { xsd:decimal }
patrick@105
   778
patrick@105
   779
smil.content = inlines