RelaxNG/publiset.rnc
author Coraline MARKWITZ
lun., 20 juin 2016 10:03:22 +0200
changeset 422 4840aea082dd
parent 418 2c303e23577d
child 444 34e00c6a3829
permissions -rw-r--r--
renommage glossary.item en item.glossary
patrick@0
     1
# $Id$
patrick@0
     2
patrick@0
     3
start = publiset
patrick@0
     4
patrick@0
     5
patrick@0
     6
publiset = element publiset {
patrick@0
     7
   publiset.attributes,
patrick@0
     8
   publiset.content
patrick@0
     9
}
patrick@0
    10
patrick@0
    11
publiset.attributes =
patrick@0
    12
   version.attribute
patrick@0
    13
version.attribute = attribute version { "1.0" }
patrick@0
    14
patrick@0
    15
publiset.content =
Patrick@382
    16
   composition
Patrick@382
    17
 | selection
patrick@0
    18
patrick@0
    19
patrick@0
    20
# =============================================================================
patrick@20
    21
#                                  HEAD LEVEL
patrick@0
    22
# =============================================================================
patrick@0
    23
patrick@0
    24
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    25
patrick@0
    26
title = element title { title.content }
patrick@127
    27
shorttitle = element shorttitle { title.content }
patrick@18
    28
subtitle = element subtitle { title.content }
patrick@2
    29
patrick@0
    30
title.content = inlines
patrick@0
    31
patrick@34
    32
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@34
    33
Patrick@256
    34
# ~~~~~~ identifier
Patrick@257
    35
identifier = element identifier {
Patrick@257
    36
   (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
Patrick@257
    37
 | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
Patrick@257
    38
}
Patrick@257
    39
Patrick@258
    40
for.attribute = attribute for { xsd:NCName }
Patrick@258
    41
Patrick@257
    42
# ~~~~~~ identifier.ean
Patrick@257
    43
identifier.ean = element identifier {
Patrick@257
    44
   attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
Patrick@257
    45
}
patrick@34
    46
Patrick@256
    47
# ~~~~~~ identifier.uri
Patrick@257
    48
identifier.uri = element identifier {
Patrick@257
    49
   attribute type { "uri" }, for.attribute?, xsd:anyURI
Patrick@257
    50
}
patrick@34
    51
patrick@39
    52
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@39
    53
patrick@39
    54
copyright = element copyright { copyright.content }
patrick@39
    55
Patrick@288
    56
copyright.content = simple.inlines
patrick@39
    57
Patrick@155
    58
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@155
    59
Patrick@155
    60
collection = element collection { collection.content }
Patrick@155
    61
Patrick@288
    62
collection.content = simple.inlines
Patrick@155
    63
patrick@66
    64
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
    65
patrick@66
    66
# ~~~~~~ contributors
patrick@66
    67
contributors = element contributors { contributors.content }
patrick@5
    68
patrick@66
    69
contributors.content =
patrick@66
    70
   contributor+
patrick@34
    71
patrick@66
    72
# ~~~~~~ contributor
patrick@66
    73
contributor = element contributor { contributor.content }
patrick@66
    74
patrick@66
    75
contributor.content =
Patrick@263
    76
   identifier.uri?,
patrick@66
    77
   (((firstname, secondname?)?, lastname) | label),
patrick@66
    78
   address?,
patrick@66
    79
   link?,
patrick@101
    80
   role+
patrick@5
    81
patrick@66
    82
# ~~~~~~ firstname, secondname, lastname, label
patrick@5
    83
firstname = element firstname { firstname.content }
patrick@66
    84
secondname = element secondname { secondname.content }
patrick@66
    85
lastname = element lastname { lastname.content }
patrick@66
    86
label = element label { label.content }
patrick@5
    87
Patrick@288
    88
firstname.content = simple.inlines
Patrick@288
    89
secondname.content = simple.inlines
Patrick@288
    90
lastname.content = simple.inlines
Patrick@288
    91
label.content = simple.inlines
patrick@5
    92
patrick@66
    93
# ~~~~~~ address
patrick@66
    94
address = element address { address.content }
patrick@5
    95
Patrick@288
    96
address.content = simple.inlines
patrick@5
    97
patrick@34
    98
# ~~~~~~ role
patrick@66
    99
role = element role { role.content }
patrick@34
   100
patrick@101
   101
role.content = "author" | "illustrator" | "publisher" | "packager"
Coraline@416
   102
 | "translator"
patrick@38
   103
Patrick@259
   104
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@259
   105
Patrick@259
   106
source = element source {
Patrick@259
   107
   (  (attribute type { "book" }, source.content.book)
Patrick@259
   108
    | (attribute type { "file" }, source.content.file))
Patrick@259
   109
}
Patrick@259
   110
Patrick@259
   111
source.content.book =
Patrick@259
   112
   identifier.ean?
Patrick@259
   113
 & title
Patrick@259
   114
 & subtitle?
Patrick@259
   115
 & copyright?
Patrick@259
   116
 & collection?
Patrick@259
   117
 & folio?
Patrick@259
   118
 & pages?
Patrick@350
   119
Patrick@259
   120
source.content.file =
Patrick@259
   121
   identifier.uri
Patrick@259
   122
Patrick@259
   123
# ~~~~~~ folio
Patrick@259
   124
folio = element folio { folio.content }
Patrick@259
   125
Patrick@259
   126
folio.content = xsd:positiveInteger | xsd:token {pattern = "[DLXVI]+"}
Patrick@259
   127
Patrick@259
   128
# ~~~~~~ pages
Patrick@259
   129
pages = element pages { pages.content }
Patrick@259
   130
Patrick@259
   131
pages.content = xsd:positiveInteger
Patrick@259
   132
Patrick@189
   133
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@98
   134
patrick@98
   135
# ~~~~~~ keywordset
patrick@98
   136
keywordset = element keywordset { keywordset.content }
patrick@98
   137
patrick@98
   138
keywordset.content = keyword+
patrick@98
   139
patrick@98
   140
# ~~~~~~ keyword
patrick@98
   141
keyword = element keyword { keyword.content }
patrick@98
   142
Patrick@288
   143
keyword.content = simple.inlines
patrick@98
   144
Patrick@189
   145
# ~~~~~~ subjectset
Patrick@189
   146
subjectset = element subjectset { subjectset.content }
Patrick@189
   147
Patrick@189
   148
subjectset.content = subject+
Patrick@189
   149
Patrick@189
   150
# ~~~~~~ subject
Patrick@189
   151
subject = element subject { subject.content }
Patrick@189
   152
Patrick@288
   153
subject.content = simple.inlines
Patrick@288
   154
Patrick@288
   155
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@288
   156
Patrick@361
   157
# ~~~~~~ indexset
Patrick@361
   158
indexset = element indexset { indexset.content }
Patrick@361
   159
Patrick@361
   160
indexset.content = head.index+
Patrick@361
   161
Patrick@288
   162
# ~~~~~~ index
Patrick@288
   163
head.index = element index { head.index.content }
Patrick@288
   164
Patrick@288
   165
head.index.content =
Patrick@288
   166
   index.entry, index.entry?
Patrick@288
   167
Patrick@288
   168
# ~~~~~~ index.entry
Patrick@288
   169
index.entry = element entry { simple.inlines }
Patrick@189
   170
yvon@52
   171
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yvon@52
   172
yvon@52
   173
abstract = element abstract { abstract.content }
yvon@52
   174
yvon@52
   175
abstract.content =
yvon@52
   176
   p+
yvon@52
   177
patrick@35
   178
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@35
   179
patrick@35
   180
cover = element cover { cover.content }
patrick@35
   181
patrick@35
   182
cover.content =
patrick@35
   183
   cover.image
patrick@35
   184
patrick@35
   185
cover.image = element image { cover.image.attributes }
patrick@35
   186
patrick@35
   187
cover.image.attributes =
Patrick@288
   188
   media.id.attribute
Patrick@288
   189
media.id.attribute = attribute id { xsd:NMTOKEN }
patrick@35
   190
Patrick@362
   191
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ element ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@362
   192
Patrick@362
   193
\element = element element { element.attributes, element.content }
Patrick@362
   194
Patrick@362
   195
element.attributes =
Patrick@362
   196
   name.attribute
Patrick@362
   197
name.attribute = attribute name { xsd:NCName }
Patrick@362
   198
   
Patrick@362
   199
element.content =
Patrick@362
   200
   (inlines | \element+)
Patrick@362
   201
patrick@0
   202
patrick@0
   203
# =============================================================================
Patrick@310
   204
#                                  TOP LEVEL
Patrick@310
   205
# =============================================================================
Patrick@310
   206
Patrick@310
   207
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@310
   208
Patrick@310
   209
# ~~~~~~ composition
Patrick@310
   210
composition = element composition {
Patrick@310
   211
   composition.attributes,
Patrick@310
   212
   composition.content
Patrick@310
   213
}
Patrick@310
   214
Patrick@310
   215
composition.attributes =
Patrick@382
   216
   composition.id.attribute?
Patrick@317
   217
 & lang.attribute?
Patrick@323
   218
 & path.attribute?
Patrick@418
   219
 & pi-fid.attribute?
Patrick@317
   220
 & pi-source.attribute?
Patrick@310
   221
 & (xpath.attribute | xslt.attribute)?
Patrick@310
   222
 & remap.attributes
Patrick@310
   223
composition.id.attribute = attribute id { xsd:NMTOKEN }
Patrick@317
   224
lang.attribute = attribute xml:lang { xsd:language }
Patrick@323
   225
path.attribute = attribute path { xsd:anyURI }
Patrick@418
   226
pi-fid.attribute = attribute pi-fid { xsd:boolean }
Patrick@317
   227
pi-source.attribute = attribute pi-source { xsd:boolean }
Patrick@323
   228
xpath.attribute = attribute xpath { text }
Patrick@310
   229
xslt.attribute = attribute xslt { xsd:anyURI }
Patrick@310
   230
Patrick@310
   231
composition.content =
Patrick@310
   232
   composition.head?,
Patrick@310
   233
   (composition.division | composition.file)+
Patrick@310
   234
Patrick@310
   235
# ~~~~~~ composition.head
Patrick@310
   236
composition.head = element head {
Patrick@310
   237
   composition.head.attributes, composition.head.content }
Patrick@310
   238
Patrick@310
   239
composition.head.attributes =
Patrick@310
   240
   remap.attributes
Patrick@310
   241
Patrick@310
   242
composition.head.content =
Patrick@384
   243
   (title & shorttitle? & subtitle*)?
Patrick@310
   244
 & identifier*
Patrick@310
   245
 & copyright*
Patrick@310
   246
 & collection?
Patrick@310
   247
 & contributors?
Patrick@310
   248
 & date?
Patrick@310
   249
 & (source, source?)?
Patrick@310
   250
 & keywordset?
Patrick@310
   251
 & subjectset?
Patrick@361
   252
 & indexset?
Patrick@310
   253
 & abstract?
Patrick@310
   254
 & cover?
Patrick@362
   255
 & \element*
Patrick@310
   256
Patrick@310
   257
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@310
   258
Patrick@310
   259
# ~~~~~~ selection
Patrick@310
   260
selection = element selection {
Patrick@310
   261
   selection.attributes,
Patrick@310
   262
   selection.content
Patrick@310
   263
}
Patrick@310
   264
Patrick@310
   265
selection.attributes =
Patrick@382
   266
   selection.id.attribute?
Patrick@317
   267
 & lang.attribute?
Patrick@310
   268
 & path.attribute?
Patrick@310
   269
selection.id.attribute = attribute id { xsd:NMTOKEN }
Patrick@310
   270
Patrick@310
   271
selection.content =
Patrick@310
   272
   selection.head?,
Patrick@310
   273
   (selection.division | selection.file | link)+
Patrick@310
   274
Patrick@310
   275
# ~~~~~~ selection.head
Patrick@310
   276
selection.head = element head { composition.head.content }
Patrick@310
   277
Patrick@310
   278
Patrick@310
   279
# =============================================================================
Patrick@310
   280
#                                DIVISION LEVEL
Patrick@310
   281
# =============================================================================
Patrick@310
   282
Patrick@310
   283
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@310
   284
Patrick@310
   285
# ~~~~~~ division
Patrick@310
   286
composition.division = element division {
Patrick@310
   287
   composition.division.attributes,
Patrick@310
   288
   composition.division.content
Patrick@310
   289
}
Patrick@310
   290
selection.division = element division {
Patrick@310
   291
   selection.division.attributes,
Patrick@310
   292
   selection.division.content
Patrick@310
   293
}
Patrick@310
   294
Patrick@310
   295
composition.division.attributes =
Patrick@310
   296
   path.attribute?
Patrick@310
   297
 & (xpath.attribute | xslt.attribute)?
Patrick@310
   298
 & remap.attributes
Patrick@400
   299
 & argument.attribute?
Patrick@405
   300
 & mode.attribute?
Patrick@310
   301
selection.division.attributes =
Patrick@310
   302
   path.attribute?
Patrick@400
   303
 & argument.attribute?
Patrick@405
   304
 & mode.attribute?
Patrick@310
   305
Patrick@310
   306
composition.division.content =
Patrick@310
   307
   composition.head?,
Patrick@310
   308
   (composition.division | composition.file)+
Patrick@310
   309
selection.division.content =
Patrick@310
   310
   selection.head?,
Patrick@310
   311
   (selection.division | selection.file | link)+
Patrick@310
   312
Patrick@310
   313
Patrick@310
   314
# =============================================================================
Patrick@310
   315
#                                  FILE LEVEL
Patrick@310
   316
# =============================================================================
Patrick@310
   317
Patrick@310
   318
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@310
   319
Patrick@310
   320
composition.file = element file { composition.file.attributes, file.content }
Patrick@310
   321
selection.file = element file { selection.file.attributes, file.content }
Patrick@310
   322
Patrick@310
   323
composition.file.attributes =
Patrick@310
   324
   path.attribute?
Patrick@310
   325
 & (xpath.attribute | xslt.attribute)?
Patrick@310
   326
 & argument.attribute?
Patrick@405
   327
 & mode.attribute?
Patrick@310
   328
selection.file.attributes =
Patrick@310
   329
   path.attribute?
Patrick@310
   330
argument.attribute = attribute argument { text }
Patrick@405
   331
mode.attribute = attribute mode { text }
Patrick@350
   332
Patrick@310
   333
file.content = xsd:anyURI
Patrick@310
   334
Patrick@310
   335
Patrick@310
   336
# =============================================================================
Patrick@310
   337
#                                 BLOCK LEVEL
Patrick@310
   338
# =============================================================================
Patrick@310
   339
Patrick@310
   340
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@310
   341
Patrick@310
   342
p = element p { p.content }
Patrick@310
   343
Patrick@310
   344
p.content =
Patrick@310
   345
   inlines
Patrick@310
   346
Patrick@310
   347
Patrick@310
   348
# =============================================================================
patrick@20
   349
#                                 INLINE LEVEL
patrick@0
   350
# =============================================================================
patrick@0
   351
patrick@0
   352
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   353
Patrick@288
   354
simple.inlines = mixed {
patrick@0
   355
   sup*
patrick@0
   356
 & sub*
Patrick@288
   357
}
Patrick@288
   358
Patrick@293
   359
inlines = mixed {
Patrick@293
   360
   sup*
Patrick@293
   361
 & sub*
Patrick@293
   362
patrick@126
   363
 & highlight*
Patrick@288
   364
 & emphasis*
Patrick@350
   365
 & name*
Patrick@293
   366
}
patrick@0
   367
patrick@0
   368
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   369
Patrick@288
   370
sup = element sup { simple.inlines }
patrick@0
   371
patrick@0
   372
sub = element sub { inlines }
patrick@0
   373
patrick@126
   374
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@126
   375
patrick@126
   376
highlight = element highlight { highlight.content }
patrick@126
   377
patrick@126
   378
highlight.content = inlines
patrick@126
   379
Patrick@288
   380
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ emphasis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@288
   381
Patrick@288
   382
emphasis = element emphasis { emphasis.content }
Patrick@288
   383
Patrick@288
   384
emphasis.content = inlines
Patrick@288
   385
Patrick@350
   386
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@350
   387
Patrick@350
   388
name = element name { name.attributes, name.content }
Patrick@350
   389
Patrick@350
   390
name.attributes =
Patrick@350
   391
   name.of.attribute?
Patrick@350
   392
name.of.attribute = attribute of {
Patrick@350
   393
   "person" | "company" | "book" | "newspaper" | "party" | "movie"
Patrick@350
   394
 | "painting" }
Patrick@350
   395
Patrick@350
   396
name.content = mixed { sup* }
Patrick@350
   397
Patrick@350
   398
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick@350
   399
Patrick@350
   400
date = element date { date.attributes, date.content }
Patrick@350
   401
Patrick@350
   402
date.attributes =
Patrick@350
   403
   date.value.attribute
Patrick@350
   404
date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
Patrick@350
   405
Patrick@350
   406
date.content = mixed { sup* }
Patrick@350
   407
patrick@36
   408
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@36
   409
patrick@36
   410
link = element link { link.attributes, link.content }
patrick@36
   411
patrick@36
   412
link.attributes =
patrick@36
   413
   uri.attribute
patrick@36
   414
uri.attribute = attribute uri { xsd:anyURI }
patrick@36
   415
Patrick@288
   416
link.content = simple.inlines
patrick@36
   417
patrick@0
   418
patrick@0
   419
# =============================================================================
patrick@20
   420
#                               REMAP ATTRIBUTES
patrick@0
   421
# =============================================================================
patrick@0
   422
patrick@0
   423
remap.attributes =
patrick@0
   424
   as.attribute?
patrick@0
   425
 & attributes.attribute?
patrick@97
   426
 & transform.attribute?
patrick@0
   427
as.attribute = attribute as { xsd:QName }
patrick@0
   428
attributes.attribute =
patrick@0
   429
   attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}
patrick@97
   430
transform.attribute = attribute transform { xsd:anyURI }