RelaxNG/publidoc.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
dim., 05 juin 2011 16:26:16 +0200
changeset 2 417bb62f2a77
parent 0 41a5385c69a2
child 3 59e42ac69f8f
permissions -rw-r--r--
Nettoyage de la présentation
patrick@0
     1
# $Id$
patrick@0
     2
patrick@0
     3
start = publidoc
patrick@0
     4
patrick@0
     5
patrick@0
     6
publidoc = element publidoc {
patrick@0
     7
   publidoc.attributes,
patrick@0
     8
   publidoc.content
patrick@0
     9
}
patrick@0
    10
patrick@0
    11
publidoc.attributes =
patrick@0
    12
   version.attribute
patrick@0
    13
version.attribute = attribute version { "1.0" }
patrick@0
    14
patrick@0
    15
publidoc.content =
patrick@0
    16
   document
patrick@0
    17
 | top.topic
patrick@0
    18
patrick@0
    19
patrick@0
    20
# =============================================================================
patrick@0
    21
#                                  Top level
patrick@0
    22
# =============================================================================
patrick@0
    23
patrick@0
    24
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    25
patrick@0
    26
document = element document { document.attributes, document.content }
patrick@0
    27
patrick@0
    28
document.attributes =
patrick@0
    29
   document.id.attribute
patrick@0
    30
document.id.attribute = attribute xml:id { xsd:ID }
patrick@0
    31
patrick@0
    32
document.content =
patrick@0
    33
   metadata?,
patrick@0
    34
   (division+ | topic+)
patrick@0
    35
patrick@0
    36
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    37
patrick@0
    38
top.topic = element topic { top.topic.attributes, topic.content }
patrick@0
    39
patrick@0
    40
patrick@0
    41
# =============================================================================
patrick@0
    42
#                               Metadata level
patrick@0
    43
# =============================================================================
patrick@0
    44
patrick@0
    45
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    46
patrick@0
    47
metadata = element metadata { metadata.content }
patrick@0
    48
patrick@0
    49
metadata.content =
patrick@0
    50
   title
patrick@0
    51
 & subtitle?
patrick@0
    52
 & author*
patrick@0
    53
 & publisher?
patrick@0
    54
 & language?
patrick@0
    55
 & date?
patrick@0
    56
 & place?
patrick@0
    57
 & source*
patrick@0
    58
 & subjectset?
patrick@0
    59
 & abstract?
patrick@0
    60
 & annotation*
patrick@0
    61
patrick@0
    62
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    63
patrick@0
    64
title = element title { title.content }
patrick@2
    65
patrick@0
    66
title.content = inlines
patrick@0
    67
patrick@0
    68
subtitle = element subtitle { title.content }
patrick@0
    69
patrick@0
    70
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    71
patrick@0
    72
author = element author { author.content }
patrick@0
    73
patrick@0
    74
author.content =
patrick@0
    75
   firstname?,
patrick@0
    76
   lastname
patrick@0
    77
patrick@0
    78
publisher = element publisher { publisher.content }
patrick@0
    79
patrick@0
    80
publisher.content = inlines
patrick@0
    81
patrick@2
    82
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
    83
patrick@2
    84
language = element language { language.attributes }
patrick@2
    85
patrick@2
    86
language.attributes = lang.attribute
patrick@2
    87
lang.attribute = attribute xml:lang { xsd:language }
patrick@2
    88
patrick@2
    89
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
    90
patrick@2
    91
place = element place { place.content }
patrick@2
    92
patrick@2
    93
place.content = inlines
patrick@2
    94
patrick@0
    95
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    96
patrick@2
    97
# ~~~~~~ source
patrick@0
    98
source = element source {
patrick@0
    99
   source.attributes,
patrick@0
   100
   (  (attribute type { "book" }, source.content.book)
patrick@0
   101
    | (attribute type { "file" })),
patrick@0
   102
   source.content
patrick@0
   103
}
patrick@0
   104
patrick@0
   105
source.attributes =
patrick@0
   106
   source.id.attribute
patrick@0
   107
source.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   108
patrick@0
   109
source.content.book =
patrick@0
   110
   title,
patrick@0
   111
   pagenumber*
patrick@0
   112
source.content =
patrick@0
   113
   annotation*
patrick@0
   114
patrick@2
   115
# ~~~~~~ pagenumber
patrick@0
   116
pagenumber = element pagenumber { pagenumber.attributes }
patrick@2
   117
patrick@0
   118
pagenumber.attributes =
patrick@0
   119
   pagenumber.value.attribute
patrick@0
   120
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
patrick@0
   121
pagenumber.value.enumeration = xsd:positiveInteger
patrick@0
   122
patrick@0
   123
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   124
patrick@2
   125
# ~~~~~~ subjectset
patrick@0
   126
subjectset = element subjectset { subjectset.content }
patrick@0
   127
patrick@0
   128
subjectset.content = subject+
patrick@0
   129
patrick@2
   130
# ~~~~~~ subject
patrick@0
   131
subject = element subject { subject.attributes }
patrick@2
   132
patrick@0
   133
subject.attributes =
patrick@0
   134
   subject.id.attribute
patrick@0
   135
subject.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   136
patrick@2
   137
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
   138
patrick@2
   139
abstract = element abstract { abstract.content }
patrick@2
   140
patrick@2
   141
abstract.content =
patrick@2
   142
   parag+
patrick@2
   143
patrick@0
   144
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   145
patrick@0
   146
annotation = element annotation { annotation.content }
patrick@0
   147
patrick@0
   148
annotation.content = inlines
patrick@0
   149
patrick@0
   150
patrick@0
   151
# =============================================================================
patrick@0
   152
#                                 Division level
patrick@0
   153
# =============================================================================
patrick@0
   154
patrick@0
   155
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   156
patrick@0
   157
division = element division { division.content }
patrick@0
   158
patrick@0
   159
division.content =
patrick@0
   160
   metadata?,
patrick@0
   161
   (division+ | topic+)
patrick@0
   162
patrick@0
   163
patrick@0
   164
# =============================================================================
patrick@0
   165
#                               Component level
patrick@0
   166
# =============================================================================
patrick@0
   167
patrick@0
   168
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   169
patrick@0
   170
topic = element topic { topic.attributes, topic.content }
patrick@0
   171
patrick@0
   172
top.topic.attributes =
patrick@0
   173
   topic.id.attribute
patrick@0
   174
 & topic.type.attribute?
patrick@0
   175
topic.attributes =
patrick@0
   176
   topic.id.attribute?
patrick@0
   177
 & topic.type.attribute?
patrick@0
   178
topic.id.attribute = attribute xml:id { xsd:ID }
patrick@0
   179
topic.type.attribute = attribute type { xsd:NCName }
patrick@0
   180
patrick@0
   181
topic.content =
patrick@0
   182
   metadata?,
patrick@0
   183
   section+
patrick@0
   184
patrick@0
   185
patrick@0
   186
# =============================================================================
patrick@0
   187
#                                 Section level
patrick@0
   188
# =============================================================================
patrick@0
   189
patrick@0
   190
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   191
patrick@0
   192
section = element section { section.content, section.attributes }
patrick@0
   193
patrick@0
   194
section.content =
patrick@0
   195
   metadata?,
patrick@0
   196
   (section+
patrick@0
   197
    | (parag | media)+)
patrick@0
   198
patrick@0
   199
section.attributes =
patrick@0
   200
   status.attribute?
patrick@0
   201
status.attribute = attribute status { xsd:NCName }
patrick@0
   202
patrick@0
   203
patrick@0
   204
# =============================================================================
patrick@0
   205
#                                 Block level
patrick@0
   206
# =============================================================================
patrick@0
   207
patrick@0
   208
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   209
patrick@0
   210
parag = element parag { parag.content }
patrick@0
   211
patrick@0
   212
parag.content =
patrick@0
   213
   inlines
patrick@0
   214
 & link*
patrick@0
   215
patrick@0
   216
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   217
patrick@2
   218
# ~~~~~~ media
patrick@0
   219
media = element media { media.content }
patrick@0
   220
patrick@0
   221
media.content =
patrick@0
   222
   image+,
patrick@0
   223
   media.caption?
patrick@0
   224
patrick@0
   225
media.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   226
patrick@2
   227
# ~~~~~~ caption
patrick@0
   228
media.caption = element caption { media.caption.content }
patrick@0
   229
patrick@2
   230
media.caption.content =
patrick@2
   231
   parag+
patrick@2
   232
patrick@2
   233
# ~~~~~~ image
patrick@0
   234
image = element image { image.attributes, image.content }
patrick@0
   235
patrick@0
   236
image.attributes =
patrick@0
   237
   media.id.attribute
patrick@0
   238
patrick@0
   239
image.content =
patrick@0
   240
   copyright?
patrick@0
   241
patrick@2
   242
# ~~~~~~ copyright
patrick@0
   243
copyright = element copyright { copyright.content }
patrick@0
   244
copyright.content = inlines
patrick@0
   245
patrick@0
   246
patrick@0
   247
# =============================================================================
patrick@0
   248
#                                 Inline level
patrick@0
   249
# =============================================================================
patrick@0
   250
patrick@0
   251
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   252
patrick@0
   253
inlines = mixed {
patrick@0
   254
   sup*
patrick@0
   255
 & sub*
patrick@0
   256
 & romannum*
patrick@0
   257
 & date*
patrick@0
   258
 & name*
patrick@0
   259
 & footnote*
patrick@0
   260
 & foreign*
patrick@0
   261
 & highlight*
patrick@0
   262
}
patrick@0
   263
patrick@0
   264
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   265
patrick@0
   266
sup = element sup { inlines }
patrick@0
   267
patrick@0
   268
sub = element sub { inlines }
patrick@0
   269
patrick@0
   270
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ romannum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   271
patrick@0
   272
romannum = element romannum { xsd:token {pattern = "([dlxvi]+)"} }
patrick@0
   273
patrick@0
   274
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   275
patrick@0
   276
date = element date { date.attributes, date.content }
patrick@0
   277
patrick@0
   278
date.attributes = date.of.attribute
patrick@0
   279
date.of.attribute = attribute of { date.of.enumeration }
patrick@0
   280
date.of.enumeration = "event" | "birth" | "death"
patrick@0
   281
patrick@0
   282
date.content = xsd:date | xsd:gYearMonth | xsd:gYear
patrick@0
   283
patrick@2
   284
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   285
patrick@0
   286
firstname = element firstname { inlines }
patrick@0
   287
patrick@0
   288
lastname = element lastname { inlines }
patrick@0
   289
patrick@0
   290
name = element name { name.attributes, name.content }
patrick@2
   291
patrick@2
   292
name.attributes =
patrick@2
   293
   name.of.attribute?
patrick@0
   294
name.of.attribute = attribute of { name.of.enumeration }
patrick@0
   295
name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party"
patrick@0
   296
patrick@2
   297
name.content = inlines
patrick@2
   298
patrick@0
   299
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footnote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   300
patrick@0
   301
footnote = element footnote { footnote.attributes, footnote.content }
patrick@0
   302
patrick@2
   303
footnote.attributes =
patrick@2
   304
   footnote.label.attribute?
patrick@0
   305
footnote.label.attribute = attribute label { text }
patrick@0
   306
patrick@2
   307
footnote.content =
patrick@2
   308
   parag+
patrick@0
   309
patrick@0
   310
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   311
patrick@0
   312
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   313
patrick@0
   314
foreign.attributes = lang.attribute?
patrick@0
   315
patrick@0
   316
foreign.content = inlines
patrick@0
   317
patrick@0
   318
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   319
patrick@0
   320
highlight = element highlight { highlight.content }
patrick@0
   321
patrick@0
   322
highlight.content = inlines
patrick@0
   323
patrick@0
   324
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   325
patrick@0
   326
link = element link { link.attributes, link.content }
patrick@0
   327
patrick@0
   328
link.attributes = empty
patrick@0
   329
patrick@0
   330
link.content = inlines