RelaxNG/publiquiz.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
sam., 01 sept. 2012 12:38:45 +0200
changeset 129 bc03da8aef31
parent 128 14dc149154f4
child 141 c9c48f6453f4
permissions -rw-r--r--
Ajout d'un accent pour test
patrick@73
     1
# $Id$
patrick@73
     2
patrick@73
     3
patrick@73
     4
include "publidoc.rnc" {
patrick@73
     5
   start = publiquiz
patrick@73
     6
patrick@73
     7
   document.content =
patrick@73
     8
      top.head?,
patrick@73
     9
      (division | topic | quiz)+
patrick@84
    10
patrick@84
    11
   division.content =
patrick@84
    12
      division.head?,
patrick@84
    13
      (division | topic | quiz)+
patrick@73
    14
}
patrick@73
    15
patrick@75
    16
patrick@73
    17
publiquiz = element publiquiz {
patrick@73
    18
   publiquiz.attributes,
patrick@73
    19
   publiquiz.content
patrick@73
    20
}
patrick@73
    21
patrick@73
    22
publiquiz.attributes =
patrick@73
    23
   version.attribute
patrick@73
    24
patrick@73
    25
publiquiz.content =
patrick@73
    26
   document
patrick@73
    27
 | top.quiz
patrick@73
    28
patrick@73
    29
patrick@73
    30
# =============================================================================
patrick@73
    31
#                                  TOP LEVEL
patrick@73
    32
# =============================================================================
patrick@73
    33
patrick@73
    34
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    35
patrick@128
    36
top.quiz = element quiz { top.quiz.attributes, top.quiz.content }
patrick@73
    37
patrick@73
    38
top.quiz.attributes =
patrick@73
    39
   quiz.id.attribute
patrick@73
    40
 & lang.attribute?
patrick@117
    41
quiz.id.attribute = attribute id { xsd:NMTOKEN }
patrick@73
    42
patrick@128
    43
top.quiz.content =
patrick@128
    44
   top.head?,
patrick@128
    45
   instructions,
patrick@128
    46
   (engine | composite),
patrick@128
    47
   help?,
patrick@128
    48
   answer?
patrick@73
    49
patrick@73
    50
# =============================================================================
patrick@73
    51
#                               COMPONENT LEVEL
patrick@73
    52
# =============================================================================
patrick@73
    53
patrick@73
    54
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ quiz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    55
patrick@73
    56
quiz = element quiz { quiz.attributes, quiz.content }
patrick@73
    57
patrick@73
    58
quiz.attributes =
patrick@122
    59
   (quiz.id.attribute | quiz.xmlid.attribute)?
patrick@73
    60
 & lang.attribute?
patrick@122
    61
quiz.xmlid.attribute = attribute xml:id { xsd:ID }
patrick@73
    62
patrick@73
    63
quiz.content =
patrick@73
    64
   component.head?,
patrick@73
    65
   instructions,
patrick@87
    66
   (engine | composite),
patrick@73
    67
   help?,
patrick@87
    68
   answer?
patrick@73
    69
patrick@73
    70
patrick@73
    71
# =============================================================================
patrick@73
    72
#                                 SECTION LEVEL
patrick@73
    73
# =============================================================================
patrick@73
    74
patrick@73
    75
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    76
patrick@73
    77
blanks.section = element section { section.attributes, blanks.section.content }
patrick@73
    78
point.section = element section { section.attributes, point.section.content }
patrick@73
    79
patrick@73
    80
blanks.section.content =
patrick@73
    81
   section.head?,
patrick@73
    82
   (blanks.section+ | blanks.block+)
patrick@73
    83
point.section.content =
patrick@73
    84
   section.head?,
patrick@73
    85
   (point.section+ | point.block+)
patrick@73
    86
patrick@73
    87
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ instructions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    88
patrick@73
    89
instructions = element instructions { section.content }
patrick@73
    90
patrick@73
    91
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ engine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
    92
patrick@73
    93
engine =
patrick@87
    94
   choices-radio
patrick@87
    95
 | choices-check
patrick@87
    96
 | blanks-fill
patrick@87
    97
 | blanks-select
patrick@73
    98
 | point
patrick@73
    99
 | matching
patrick@73
   100
 | sort
patrick@125
   101
 | categories
patrick@87
   102
 | production
patrick@73
   103
patrick@73
   104
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ choices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   105
patrick@87
   106
choices-radio = element choices-radio {
patrick@87
   107
   choices.attributes, choices-radio.content }
patrick@87
   108
choices-check = element choices-check {
patrick@87
   109
   choices.attributes, choices-check.content }
patrick@73
   110
patrick@73
   111
choices.attributes =
patrick@73
   112
   shuffle.attribute?
patrick@73
   113
shuffle.attribute = attribute shuffle { xsd:boolean }
patrick@73
   114
patrick@87
   115
choices-radio.content =
patrick@73
   116
   choices.right
patrick@73
   117
 & choices.wrong+
patrick@87
   118
choices-check.content =
patrick@73
   119
   (choices.right | choices.wrong)+
patrick@73
   120
patrick@73
   121
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   122
patrick@87
   123
blanks-fill = element blanks-fill {
patrick@87
   124
   blanks-fill.attributes, blanks-fill.content }
patrick@87
   125
blanks-select = element blanks-select {
patrick@87
   126
   blanks-select.attributes, blanks-select.content }
patrick@73
   127
patrick@87
   128
blanks-fill.attributes =
patrick@75
   129
   strict.attribute?
patrick@87
   130
blanks-select.attributes =
patrick@73
   131
   multiple.attribute?
patrick@73
   132
strict.attribute = attribute strict { xsd:boolean }
patrick@73
   133
multiple.attribute = attribute multiple { xsd:boolean }
patrick@73
   134
patrick@87
   135
blanks-fill.content =
patrick@73
   136
   (blanks.block+ | blanks.section+)
patrick@87
   137
blanks-select.content =
patrick@73
   138
   blanks.wrongs?,
patrick@73
   139
   (blanks.block+ | blanks.section+)
patrick@73
   140
patrick@73
   141
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   142
patrick@73
   143
point = element point { point.attributes, point.content }
patrick@75
   144
patrick@73
   145
point.attributes =
patrick@73
   146
   point.type.attribute?
patrick@73
   147
point.type.attribute = attribute type {
patrick@73
   148
   "radio" | "radio_button" | "check" | "check_button" }
patrick@73
   149
patrick@73
   150
point.content =
patrick@73
   151
   (point.section+ | point.block+)
patrick@73
   152
patrick@73
   153
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   154
patrick@73
   155
matching = element matching { matching.content }
patrick@75
   156
patrick@73
   157
matching.content =
patrick@73
   158
   match,
patrick@73
   159
   match+
patrick@73
   160
patrick@73
   161
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sort ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   162
patrick@73
   163
sort = element sort { sort.attributes, sort.content }
patrick@73
   164
patrick@73
   165
sort.attributes =
patrick@73
   166
   shuffle.attribute?
patrick@75
   167
patrick@73
   168
sort.content =
patrick@73
   169
   comparison?,
patrick@73
   170
   sort.item,
patrick@73
   171
   sort.item+
patrick@73
   172
patrick@125
   173
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@125
   174
patrick@125
   175
# ~~~~~~ categories
patrick@125
   176
categories = element categories { categories.content }
patrick@125
   177
patrick@125
   178
categories.content =
patrick@125
   179
   category,
patrick@125
   180
   category+
patrick@125
   181
patrick@125
   182
# ~~~~~~ category
patrick@125
   183
category = element category { category.content }
patrick@125
   184
patrick@125
   185
category.content =
patrick@125
   186
   category.head,
patrick@125
   187
   category.item*
patrick@125
   188
   
patrick@125
   189
# ~~~~~~ category.head
patrick@125
   190
category.head = element head { category.head.content }
patrick@125
   191
patrick@125
   192
category.head.content =
patrick@125
   193
   title,
patrick@127
   194
   shorttitle?,
patrick@125
   195
   subtitle?
patrick@125
   196
patrick@87
   197
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ production ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@87
   198
patrick@87
   199
production = element production { empty }
patrick@87
   200
patrick@73
   201
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composite ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   202
patrick@77
   203
# ~~~~~~ composite
patrick@73
   204
composite = element composite { composite.content }
patrick@75
   205
patrick@73
   206
composite.content =
patrick@85
   207
   subquiz,
patrick@85
   208
   subquiz+
patrick@77
   209
patrick@85
   210
# ~~~~~~ subquiz
patrick@85
   211
subquiz = element subquiz { subquiz.content }
patrick@77
   212
patrick@85
   213
subquiz.content =
patrick@77
   214
   instructions?,
patrick@77
   215
   engine
patrick@73
   216
patrick@73
   217
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   218
patrick@73
   219
help = element help { help.content }
patrick@73
   220
patrick@73
   221
help.content =
patrick@73
   222
   (section+ | block+)?,
patrick@73
   223
   link*
patrick@73
   224
patrick@87
   225
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   226
patrick@87
   227
answer = element answer { answer.content }
patrick@73
   228
patrick@87
   229
answer.content =
patrick@81
   230
   (section+ | block+)?,
patrick@80
   231
   link*
patrick@73
   232
patrick@73
   233
patrick@73
   234
# =============================================================================
patrick@73
   235
#                                 BLOCK LEVEL
patrick@73
   236
# =============================================================================
patrick@73
   237
patrick@73
   238
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   239
patrick@73
   240
blanks.block =
patrick@73
   241
   (blanks.p | speech | blanks.list | blockquote | blanks.table | media)
patrick@73
   242
point.block =
patrick@73
   243
   (point.p | speech | point.list | blockquote | point.table | media)
patrick@73
   244
patrick@73
   245
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   246
patrick@73
   247
blanks.p = element p { blanks.p.content }
patrick@73
   248
point.p = element p { point.p.content }
patrick@73
   249
patrick@73
   250
blanks.p.content =
patrick@75
   251
   blanks.inlines
patrick@73
   252
point.p.content =
patrick@75
   253
   point.inlines
patrick@73
   254
patrick@73
   255
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   256
patrick@73
   257
# ~~~~~~ list
patrick@75
   258
blanks.list = element list {
patrick@73
   259
   block.head?,
patrick@73
   260
   (  (attribute type {"ordered"}?, blanks.item, blanks.item+)
patrick@73
   261
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   262
}
patrick@75
   263
point.list = element list {
patrick@73
   264
   block.head?,
patrick@73
   265
   (  (attribute type {"ordered"}?, point.item, point.item+)
patrick@73
   266
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   267
}
patrick@73
   268
patrick@73
   269
# ~~~~~~ item
patrick@73
   270
blanks.item = element item { blanks.item.content }
patrick@73
   271
point.item = element item { point.item.content }
patrick@73
   272
patrick@73
   273
blanks.item.content =
patrick@75
   274
   blanks.inlines
patrick@73
   275
 | blanks.block+
patrick@73
   276
point.item.content =
patrick@75
   277
   point.inlines
patrick@73
   278
 | point.block+
patrick@73
   279
patrick@73
   280
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   281
patrick@73
   282
blanks.table = element table { blanks.table.content }
patrick@73
   283
point.table = element table { point.table.content }
patrick@73
   284
patrick@73
   285
blanks.table.content =
patrick@73
   286
   block.head?,
patrick@73
   287
   blanks.tgroup+,
patrick@111
   288
   table.caption?
patrick@73
   289
point.table.content =
patrick@73
   290
   block.head?,
patrick@73
   291
   point.tgroup+,
patrick@111
   292
   table.caption?
patrick@73
   293
patrick@73
   294
# ~~~~~~ tgroup
patrick@73
   295
blanks.tgroup = element tgroup { tgroup.attributes, blanks.tgroup.content }
patrick@73
   296
point.tgroup = element tgroup { tgroup.attributes, point.tgroup.content }
patrick@73
   297
patrick@73
   298
blanks.tgroup.content =
patrick@73
   299
   thead?,
patrick@73
   300
   blanks.tbody
patrick@73
   301
point.tgroup.content =
patrick@73
   302
   thead?,
patrick@73
   303
   point.tbody
patrick@73
   304
patrick@73
   305
# ~~~~~~ tbody
patrick@73
   306
blanks.tbody = element tbody { tbody.attributes, blanks.tbody.content }
patrick@73
   307
point.tbody = element tbody { tbody.attributes, point.tbody.content }
patrick@73
   308
patrick@73
   309
blanks.tbody.content =
patrick@73
   310
   blanks.row+
patrick@73
   311
point.tbody.content =
patrick@73
   312
   point.row+
patrick@73
   313
patrick@73
   314
# ~~~~~~ row
patrick@73
   315
blanks.row = element row { row.attribute, blanks.row.content }
patrick@73
   316
point.row = element row { row.attribute, point.row.content }
patrick@73
   317
patrick@73
   318
blanks.row.content =
patrick@73
   319
  blanks.entry+
patrick@73
   320
point.row.content =
patrick@73
   321
  point.entry+
patrick@73
   322
patrick@73
   323
# ~~~~~~ entry
patrick@73
   324
blanks.entry = element entry { blanks.entry.content }
patrick@73
   325
point.entry = element entry { point.entry.content }
patrick@73
   326
patrick@73
   327
blanks.entry.content =
patrick@75
   328
   blanks.inlines
patrick@73
   329
 | (p | media)+
patrick@73
   330
patrick@73
   331
point.entry.content =
patrick@75
   332
   point.inlines
patrick@73
   333
 | (p | media)+
patrick@73
   334
patrick@73
   335
patrick@73
   336
# ~~~~~~~~~~~~~~~~~~~~~~~~ choices.right, choices.wrong ~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   337
patrick@73
   338
choices.right = element right { choices.right.content }
patrick@73
   339
choices.wrong = element wrong { choices.right.content }
patrick@73
   340
patrick@73
   341
choices.right.content =
patrick@73
   342
   inlines
patrick@73
   343
 | p+
patrick@73
   344
patrick@73
   345
patrick@73
   346
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks.wrongs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   347
patrick@73
   348
# ~~~~~~ blanks.wrongs
patrick@73
   349
blanks.wrongs = element wrongs { blanks.wrongs.content }
patrick@73
   350
patrick@73
   351
blanks.wrongs.content =
patrick@73
   352
   blanks.wrong+
patrick@73
   353
patrick@73
   354
# ~~~~~~ blanks.wrong
patrick@73
   355
blanks.wrong = element wrong { blanks.wrong.content }
patrick@73
   356
patrick@73
   357
blanks.wrong.content = text
patrick@73
   358
patrick@73
   359
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ match ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   360
patrick@73
   361
match = element match { match.content }
patrick@73
   362
patrick@73
   363
match.content =
patrick@73
   364
   (p | section),
patrick@73
   365
   (p | section)
patrick@73
   366
patrick@75
   367
# ~~~~~~~~~~~~~~~~~~~~~~~~ (sort) comparison, item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   368
patrick@73
   369
# ~~~~~~ comparison
patrick@73
   370
comparison = element comparison { comparison.content }
patrick@73
   371
patrick@73
   372
comparison.content = inlines
patrick@73
   373
patrick@73
   374
# ~~~~~~ sort.item
patrick@73
   375
sort.item = element item { sort.item.attributes, sort.item.content }
patrick@73
   376
patrick@73
   377
sort.item.attributes =
patrick@73
   378
   item.shuffle.attribute?
patrick@73
   379
item.shuffle.attribute = attribute shuffle { xsd:integer }
patrick@73
   380
patrick@73
   381
sort.item.content = inlines
patrick@73
   382
patrick@125
   383
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (category) item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@125
   384
patrick@125
   385
# ~~~~~~ category.item
patrick@125
   386
category.item = element item { category.item.content }
patrick@125
   387
patrick@125
   388
category.item.content = inlines
patrick@125
   389
patrick@73
   390
patrick@73
   391
# =============================================================================
patrick@73
   392
#                                 INLINE LEVEL
patrick@73
   393
# =============================================================================
patrick@73
   394
patrick@75
   395
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@75
   396
patrick@75
   397
blanks.inlines = mixed {
patrick@75
   398
   sup*
patrick@75
   399
 & sub*
patrick@75
   400
 & var*
patrick@75
   401
 & number*
patrick@75
   402
 & math*
patrick@75
   403
 & date*
patrick@75
   404
 & name*
patrick@75
   405
 & note*
patrick@75
   406
 & foreign*
patrick@75
   407
 & highlight*
patrick@75
   408
 & mentioned*
patrick@75
   409
 & quote*
patrick@75
   410
 & acronym*
patrick@75
   411
 & term*
patrick@75
   412
 & link*
patrick@75
   413
 & anchor*
patrick@75
   414
 & blank*
patrick@75
   415
}
patrick@75
   416
point.inlines = mixed {
patrick@75
   417
   sup*
patrick@75
   418
 & sub*
patrick@75
   419
 & var*
patrick@75
   420
 & number*
patrick@75
   421
 & math*
patrick@75
   422
 & date*
patrick@75
   423
 & name*
patrick@75
   424
 & note*
patrick@75
   425
 & foreign*
patrick@75
   426
 & highlight*
patrick@75
   427
 & mentioned*
patrick@75
   428
 & quote*
patrick@75
   429
 & acronym*
patrick@75
   430
 & term*
patrick@75
   431
 & link*
patrick@75
   432
 & anchor*
patrick@75
   433
 & blank*
patrick@75
   434
 & point.right*
patrick@75
   435
 & point.wrong*
patrick@75
   436
}
patrick@75
   437
patrick@73
   438
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blank ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   439
patrick@73
   440
# ~~~~~~ blank
patrick@73
   441
blank = element blank { blank.content }
patrick@73
   442
patrick@73
   443
blank.content =
patrick@73
   444
   text
patrick@87
   445
 | (s+, help?, answer?)
patrick@73
   446
patrick@73
   447
# ~~~~~~ s
patrick@73
   448
s = element s { s.content }
patrick@73
   449
patrick@73
   450
s.content = text
patrick@73
   451
patrick@73
   452
# ~~~~~~~~~~~~~~~~~~~~~~~~~ point.right, point.wrong ~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   453
patrick@73
   454
point.right = element right { point.right.content }
patrick@73
   455
point.wrong = element wrong { point.right.content }
patrick@73
   456
patrick@73
   457
point.right.content = inlines