RelaxNG/publidoc.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
ven., 10 juin 2011 16:35:10 +0200
changeset 8 1d4ee28efd68
parent 5 69310bc35b63
child 9 1efd69b7c90e
permissions -rw-r--r--
Mise en forme
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@5
    72
# ~~~~~~ author
patrick@0
    73
author = element author { author.content }
patrick@0
    74
patrick@0
    75
author.content =
patrick@0
    76
   firstname?,
patrick@0
    77
   lastname
patrick@0
    78
patrick@5
    79
# ~~~~~~ publisher
patrick@0
    80
publisher = element publisher { publisher.content }
patrick@0
    81
patrick@0
    82
publisher.content = inlines
patrick@0
    83
patrick@5
    84
# ~~~~~~ firstname
patrick@5
    85
firstname = element firstname { firstname.content }
patrick@5
    86
patrick@5
    87
firstname.content = inlines
patrick@5
    88
patrick@5
    89
# ~~~~~~ lastname
patrick@5
    90
lastname = element lastname { lastname.content }
patrick@5
    91
patrick@5
    92
lastname.content = inlines
patrick@5
    93
patrick@2
    94
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
    95
patrick@2
    96
language = element language { language.attributes }
patrick@2
    97
patrick@2
    98
language.attributes = lang.attribute
patrick@2
    99
lang.attribute = attribute xml:lang { xsd:language }
patrick@2
   100
patrick@2
   101
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
   102
patrick@2
   103
place = element place { place.content }
patrick@2
   104
patrick@2
   105
place.content = inlines
patrick@2
   106
patrick@0
   107
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   108
patrick@2
   109
# ~~~~~~ source
patrick@0
   110
source = element source {
patrick@0
   111
   source.attributes,
patrick@0
   112
   (  (attribute type { "book" }, source.content.book)
patrick@0
   113
    | (attribute type { "file" })),
patrick@0
   114
   source.content
patrick@0
   115
}
patrick@0
   116
patrick@0
   117
source.attributes =
patrick@0
   118
   source.id.attribute
patrick@0
   119
source.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   120
patrick@0
   121
source.content.book =
patrick@0
   122
   title,
patrick@0
   123
   pagenumber*
patrick@0
   124
source.content =
patrick@0
   125
   annotation*
patrick@0
   126
patrick@2
   127
# ~~~~~~ pagenumber
patrick@0
   128
pagenumber = element pagenumber { pagenumber.attributes }
patrick@2
   129
patrick@0
   130
pagenumber.attributes =
patrick@0
   131
   pagenumber.value.attribute
patrick@0
   132
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
patrick@0
   133
pagenumber.value.enumeration = xsd:positiveInteger
patrick@0
   134
patrick@0
   135
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   136
patrick@2
   137
# ~~~~~~ subjectset
patrick@0
   138
subjectset = element subjectset { subjectset.content }
patrick@0
   139
patrick@0
   140
subjectset.content = subject+
patrick@0
   141
patrick@2
   142
# ~~~~~~ subject
patrick@0
   143
subject = element subject { subject.attributes }
patrick@2
   144
patrick@0
   145
subject.attributes =
patrick@0
   146
   subject.id.attribute
patrick@0
   147
subject.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   148
patrick@5
   149
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@2
   150
patrick@2
   151
abstract = element abstract { abstract.content }
patrick@2
   152
patrick@2
   153
abstract.content =
patrick@2
   154
   parag+
patrick@2
   155
patrick@0
   156
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   157
patrick@0
   158
annotation = element annotation { annotation.content }
patrick@0
   159
patrick@0
   160
annotation.content = inlines
patrick@0
   161
patrick@0
   162
patrick@0
   163
# =============================================================================
patrick@0
   164
#                                 Division level
patrick@0
   165
# =============================================================================
patrick@0
   166
patrick@0
   167
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   168
patrick@0
   169
division = element division { division.content }
patrick@0
   170
patrick@0
   171
division.content =
patrick@0
   172
   metadata?,
patrick@0
   173
   (division+ | topic+)
patrick@0
   174
patrick@0
   175
patrick@0
   176
# =============================================================================
patrick@0
   177
#                               Component level
patrick@0
   178
# =============================================================================
patrick@0
   179
patrick@0
   180
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   181
patrick@0
   182
topic = element topic { topic.attributes, topic.content }
patrick@0
   183
patrick@0
   184
top.topic.attributes =
patrick@0
   185
   topic.id.attribute
patrick@0
   186
 & topic.type.attribute?
patrick@0
   187
topic.attributes =
patrick@0
   188
   topic.id.attribute?
patrick@0
   189
 & topic.type.attribute?
patrick@0
   190
topic.id.attribute = attribute xml:id { xsd:ID }
patrick@0
   191
topic.type.attribute = attribute type { xsd:NCName }
patrick@0
   192
patrick@0
   193
topic.content =
patrick@0
   194
   metadata?,
patrick@0
   195
   section+
patrick@0
   196
patrick@0
   197
patrick@0
   198
# =============================================================================
patrick@0
   199
#                                 Section level
patrick@0
   200
# =============================================================================
patrick@0
   201
patrick@0
   202
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   203
patrick@0
   204
section = element section { section.content, section.attributes }
patrick@0
   205
patrick@0
   206
section.content =
patrick@0
   207
   metadata?,
patrick@0
   208
   (section+
patrick@5
   209
    | (parag | media | speech)+)
patrick@0
   210
patrick@0
   211
section.attributes =
patrick@0
   212
   status.attribute?
patrick@0
   213
status.attribute = attribute status { xsd:NCName }
patrick@0
   214
patrick@0
   215
patrick@0
   216
# =============================================================================
patrick@0
   217
#                                 Block level
patrick@0
   218
# =============================================================================
patrick@0
   219
patrick@0
   220
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   221
patrick@0
   222
parag = element parag { parag.content }
patrick@0
   223
patrick@0
   224
parag.content =
patrick@0
   225
   inlines
patrick@0
   226
 & link*
patrick@0
   227
patrick@0
   228
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   229
patrick@2
   230
# ~~~~~~ media
patrick@0
   231
media = element media { media.content }
patrick@0
   232
patrick@0
   233
media.content =
patrick@0
   234
   image+,
patrick@0
   235
   media.caption?
patrick@0
   236
patrick@0
   237
media.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
   238
patrick@2
   239
# ~~~~~~ image
patrick@0
   240
image = element image { image.attributes, image.content }
patrick@0
   241
patrick@0
   242
image.attributes =
patrick@0
   243
   media.id.attribute
patrick@0
   244
patrick@0
   245
image.content =
patrick@0
   246
   copyright?
patrick@0
   247
patrick@3
   248
# ~~~~~~ caption
patrick@3
   249
media.caption = element caption { media.caption.content }
patrick@3
   250
patrick@3
   251
media.caption.content =
patrick@3
   252
   parag+
patrick@3
   253
patrick@2
   254
# ~~~~~~ copyright
patrick@0
   255
copyright = element copyright { copyright.content }
patrick@3
   256
patrick@0
   257
copyright.content = inlines
patrick@0
   258
patrick@0
   259
patrick@5
   260
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   261
patrick@5
   262
# ~~~~~~ speech
patrick@5
   263
speech = element speech { speech.content }
patrick@5
   264
patrick@5
   265
speech.content =
patrick@5
   266
   speaker?,
patrick@5
   267
   stage?,
patrick@5
   268
   parag+
patrick@5
   269
patrick@5
   270
# ~~~~~~ speaker
patrick@5
   271
speaker = element speaker { speaker.content }
patrick@5
   272
patrick@5
   273
speaker.content = inlines
patrick@5
   274
patrick@5
   275
# ~~~~~~ stage
patrick@5
   276
stage = element stage { stage.content }
patrick@5
   277
patrick@5
   278
stage.content = inlines
patrick@5
   279
patrick@5
   280
patrick@0
   281
# =============================================================================
patrick@0
   282
#                                 Inline level
patrick@0
   283
# =============================================================================
patrick@0
   284
patrick@0
   285
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   286
patrick@0
   287
inlines = mixed {
patrick@0
   288
   sup*
patrick@0
   289
 & sub*
patrick@0
   290
 & romannum*
patrick@0
   291
 & date*
patrick@0
   292
 & name*
patrick@5
   293
 & note*
patrick@0
   294
 & foreign*
patrick@0
   295
 & highlight*
patrick@5
   296
 & mentioned*
patrick@5
   297
 & quote*
patrick@8
   298
 & acronym*
patrick@8
   299
 & term*
patrick@0
   300
}
patrick@0
   301
patrick@0
   302
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   303
patrick@0
   304
sup = element sup { inlines }
patrick@0
   305
patrick@0
   306
sub = element sub { inlines }
patrick@0
   307
patrick@0
   308
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ romannum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   309
patrick@0
   310
romannum = element romannum { xsd:token {pattern = "([dlxvi]+)"} }
patrick@0
   311
patrick@0
   312
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   313
patrick@0
   314
date = element date { date.attributes, date.content }
patrick@0
   315
patrick@3
   316
date.attributes =
patrick@5
   317
   date.of.attribute?
patrick@0
   318
date.of.attribute = attribute of { date.of.enumeration }
patrick@0
   319
date.of.enumeration = "event" | "birth" | "death"
patrick@0
   320
patrick@0
   321
date.content = xsd:date | xsd:gYearMonth | xsd:gYear
patrick@0
   322
patrick@2
   323
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   324
patrick@0
   325
name = element name { name.attributes, name.content }
patrick@2
   326
patrick@2
   327
name.attributes =
patrick@2
   328
   name.of.attribute?
patrick@0
   329
name.of.attribute = attribute of { name.of.enumeration }
patrick@0
   330
name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party"
patrick@0
   331
patrick@2
   332
name.content = inlines
patrick@2
   333
patrick@5
   334
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   335
patrick@5
   336
note = element note { note.attributes, note.content }
patrick@0
   337
patrick@5
   338
note.attributes =
patrick@5
   339
   note.label.attribute?
patrick@5
   340
note.label.attribute = attribute label { text }
patrick@0
   341
patrick@5
   342
note.content =
patrick@2
   343
   parag+
patrick@0
   344
patrick@0
   345
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   346
patrick@0
   347
foreign = element foreign { foreign.attributes, foreign.content }
patrick@0
   348
patrick@0
   349
foreign.attributes = lang.attribute?
patrick@0
   350
patrick@0
   351
foreign.content = inlines
patrick@0
   352
patrick@0
   353
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   354
patrick@0
   355
highlight = element highlight { highlight.content }
patrick@0
   356
patrick@0
   357
highlight.content = inlines
patrick@0
   358
patrick@5
   359
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mentioned ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   360
patrick@5
   361
mentioned = element mentioned { mentioned.content }
patrick@5
   362
patrick@5
   363
mentioned.content = inlines
patrick@5
   364
patrick@5
   365
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@5
   366
patrick@5
   367
quote = element quote { quote.content }
patrick@5
   368
patrick@5
   369
quote.content = inlines
patrick@5
   370
patrick@8
   371
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ acronym ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   372
patrick@8
   373
acronym = element acronym { acronym.content }
patrick@8
   374
patrick@8
   375
acronym.content = inlines
patrick@8
   376
patrick@8
   377
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@8
   378
patrick@8
   379
term = element term { term.content }
patrick@8
   380
patrick@8
   381
term.content = inlines
patrick@8
   382
patrick@0
   383
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   384
patrick@0
   385
link = element link { link.attributes, link.content }
patrick@0
   386
patrick@0
   387
link.attributes = empty
patrick@0
   388
patrick@0
   389
link.content = inlines