RelaxNG/publiset.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
lun., 18 juil. 2011 23:35:32 +0200
changeset 34 c51d5097d065
parent 30 c0f9e813c039
child 35 de4114d12ef1
permissions -rw-r--r--
Amélioration de la gestion des auteurs et des éditeurs
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@0
    25
composition = element composition {
patrick@0
    26
   composition.attributes,
patrick@0
    27
   composition.content
patrick@0
    28
}
patrick@0
    29
patrick@0
    30
composition.attributes =
patrick@0
    31
   composition.id.attribute
patrick@29
    32
 & path.attribute?
patrick@29
    33
 & xpath.attribute?
patrick@29
    34
 & xslt.attribute?
patrick@0
    35
 & remap.attributes
patrick@0
    36
composition.id.attribute = attribute xml:id { xsd:ID }
patrick@29
    37
path.attribute = attribute path { xsd:anyURI }
patrick@29
    38
xslt.attribute = attribute xslt { xsd:anyURI }
patrick@29
    39
xpath.attribute = attribute xpath { text }
patrick@0
    40
patrick@0
    41
composition.content =
patrick@20
    42
   composition.head?,
patrick@30
    43
   (composition.division | composition.file)+
patrick@0
    44
patrick@0
    45
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    46
patrick@0
    47
selection = element selection {
patrick@0
    48
   selection.attributes,
patrick@0
    49
   selection.content
patrick@0
    50
}
patrick@0
    51
patrick@0
    52
selection.attributes =
patrick@29
    53
   selection.id.attribute
patrick@29
    54
 & path.attribute?
patrick@0
    55
selection.id.attribute = attribute xml:id { xsd:ID }
patrick@0
    56
patrick@0
    57
selection.content =
patrick@20
    58
   selection.head?,
patrick@30
    59
   (selection.division | selection.file | link)+
patrick@0
    60
patrick@0
    61
patrick@0
    62
# =============================================================================
patrick@20
    63
#                                  HEAD LEVEL
patrick@0
    64
# =============================================================================
patrick@0
    65
patrick@20
    66
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    67
patrick@20
    68
composition.head = element head { head.attributes, top.head.content }
patrick@20
    69
selection.head = element head { top.head.content }
patrick@20
    70
division.head = element head { division.head.content }
patrick@0
    71
patrick@20
    72
head.attributes =
patrick@0
    73
   remap.attributes
patrick@0
    74
patrick@20
    75
top.head.content =
patrick@18
    76
   (title, subtitle?)?
patrick@34
    77
 & identifier*
patrick@18
    78
 & language?
patrick@5
    79
 & author*
patrick@5
    80
 & publisher?
patrick@5
    81
 & source?
patrick@20
    82
division.head.content =
patrick@20
    83
   (title, subtitle?)?
patrick@20
    84
 & language?
patrick@0
    85
patrick@0
    86
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    87
patrick@0
    88
title = element title { title.content }
patrick@18
    89
subtitle = element subtitle { title.content }
patrick@2
    90
patrick@0
    91
title.content = inlines
patrick@0
    92
patrick@34
    93
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@34
    94
patrick@34
    95
identifier = element identifier { identifier.content, identifier.attributes }
patrick@34
    96
patrick@34
    97
identifier.attributes =
patrick@34
    98
   class.attribute
patrick@34
    99
class.attribute = attribute class { "uri" | "ean" }
patrick@34
   100
patrick@34
   101
identifier.content =  xsd:anyURI | xsd:NMTOKEN
patrick@34
   102
patrick@18
   103
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@18
   104
patrick@18
   105
language = element language { language.attributes }
patrick@18
   106
patrick@18
   107
language.attributes = lang.attribute
patrick@18
   108
lang.attribute = attribute xml:lang { xsd:language }
patrick@0
   109
patrick@5
   110
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   111
patrick@5
   112
# ~~~~~~ author
patrick@5
   113
author = element author { author.content }
patrick@5
   114
patrick@34
   115
author.attributes =
patrick@34
   116
   role.attribute?
patrick@34
   117
role.attribute = attribute role { "author" | "illustrator" }
patrick@34
   118
patrick@5
   119
author.content =
patrick@5
   120
   firstname?,
patrick@34
   121
   lastname,
patrick@34
   122
   role*
patrick@5
   123
patrick@5
   124
# ~~~~~~ publisher
patrick@5
   125
publisher = element publisher { publisher.content }
patrick@5
   126
patrick@34
   127
publisher.content =
patrick@34
   128
   label,
patrick@34
   129
   url?
patrick@5
   130
patrick@5
   131
# ~~~~~~ firstname
patrick@5
   132
firstname = element firstname { firstname.content }
patrick@5
   133
patrick@5
   134
firstname.content = inlines
patrick@5
   135
patrick@5
   136
# ~~~~~~ lastname
patrick@5
   137
lastname = element lastname { lastname.content }
patrick@5
   138
patrick@5
   139
lastname.content = inlines
patrick@5
   140
patrick@34
   141
# ~~~~~~ label
patrick@34
   142
label = element label { label.content }
patrick@34
   143
patrick@34
   144
label.content = inlines
patrick@34
   145
patrick@34
   146
# ~~~~~~ role
patrick@34
   147
role = element role { role.attributes }
patrick@34
   148
patrick@34
   149
role.attributes =
patrick@34
   150
   role.of.attribute
patrick@34
   151
role.of.attribute = attribute of { "author" | "illustrator" }
patrick@34
   152
patrick@34
   153
# ~~~~~~ url
patrick@34
   154
url = element url { url.content }
patrick@34
   155
patrick@34
   156
url.content = xsd:anyURI
patrick@34
   157
patrick@0
   158
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   159
patrick@2
   160
# ~~~~~~ source
patrick@0
   161
source = element source {
patrick@0
   162
   source.attributes,
patrick@0
   163
   (  (attribute type { "book" }, source.content.book)
patrick@0
   164
    | (attribute type { "file" }))
patrick@0
   165
}
patrick@0
   166
patrick@0
   167
source.attributes =
patrick@0
   168
   source.id.attribute?
patrick@0
   169
 & remap.attributes
patrick@0
   170
source.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   171
patrick@0
   172
source.content.book =
patrick@0
   173
   title?,
patrick@0
   174
   pagenumber?
patrick@0
   175
patrick@2
   176
# ~~~~~~ pagenumber
patrick@0
   177
pagenumber = element pagenumber { pagenumber.attributes }
patrick@2
   178
patrick@0
   179
pagenumber.attributes =
patrick@0
   180
   pagenumber.value.attribute
patrick@0
   181
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
patrick@0
   182
pagenumber.value.enumeration = xsd:positiveInteger
patrick@0
   183
patrick@0
   184
patrick@0
   185
# =============================================================================
patrick@20
   186
#                                DIVISION LEVEL
patrick@0
   187
# =============================================================================
patrick@0
   188
patrick@0
   189
composition.division = element division {
patrick@0
   190
   composition.division.attributes,
patrick@0
   191
   composition.division.content
patrick@0
   192
}
patrick@0
   193
selection.division = element division {
patrick@0
   194
   selection.division.attributes,
patrick@0
   195
   selection.division.content
patrick@0
   196
}
patrick@0
   197
patrick@0
   198
composition.division.attributes =
patrick@26
   199
   path.attribute?
patrick@29
   200
 & xpath.attribute?
patrick@23
   201
 & xslt.attribute?
patrick@0
   202
 & remap.attributes
patrick@0
   203
selection.division.attributes =
patrick@26
   204
   path.attribute?
patrick@0
   205
patrick@0
   206
composition.division.content =
patrick@20
   207
   composition.head?,
patrick@20
   208
   (composition.division | composition.file)+
patrick@0
   209
selection.division.content =
patrick@20
   210
   selection.head?,
patrick@30
   211
   (selection.division | selection.file | link)+
patrick@0
   212
patrick@0
   213
patrick@0
   214
# =============================================================================
patrick@20
   215
#                                  FILE LEVEL
patrick@0
   216
# =============================================================================
patrick@0
   217
patrick@0
   218
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   219
patrick@30
   220
composition.file = element file { composition.file.attributes }
patrick@2
   221
selection.file = element file { selection.file.attributes, file.content }
patrick@0
   222
patrick@0
   223
composition.file.attributes =
patrick@30
   224
   name.attribute
patrick@30
   225
 & xpath.attribute?
patrick@29
   226
 & xslt.attribute?
patrick@0
   227
 & remap.attributes
patrick@0
   228
selection.file.attributes =
patrick@30
   229
   name.attribute
patrick@30
   230
 & uri.attribute?
patrick@30
   231
name.attribute = attribute name { xsd:anyURI }
patrick@30
   232
uri.attribute = attribute uri { xsd:anyURI }
patrick@0
   233
patrick@30
   234
file.content = inlines
patrick@30
   235
patrick@30
   236
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@30
   237
patrick@30
   238
link = element link { link.attributes, link.content }
patrick@30
   239
patrick@30
   240
link.attributes =
patrick@30
   241
   uri.attribute
patrick@30
   242
patrick@30
   243
link.content = inlines
patrick@30
   244
patrick@30
   245
patrick@0
   246
# =============================================================================
patrick@20
   247
#                                 INLINE LEVEL
patrick@0
   248
# =============================================================================
patrick@0
   249
patrick@0
   250
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   251
patrick@0
   252
inlines = mixed {
patrick@0
   253
   sup*
patrick@0
   254
 & sub*
patrick@0
   255
}
patrick@0
   256
patrick@0
   257
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   258
patrick@0
   259
sup = element sup { inlines }
patrick@0
   260
patrick@0
   261
sub = element sub { inlines }
patrick@0
   262
patrick@0
   263
patrick@0
   264
# =============================================================================
patrick@20
   265
#                               REMAP ATTRIBUTES
patrick@0
   266
# =============================================================================
patrick@0
   267
patrick@0
   268
remap.attributes =
patrick@0
   269
   as.attribute?
patrick@0
   270
 & attributes.attribute?
patrick@0
   271
as.attribute = attribute as { xsd:QName }
patrick@0
   272
attributes.attribute =
patrick@0
   273
   attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}