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