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