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