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