RelaxNG/publiquiz.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
mar., 18 déc. 2012 22:40:03 +0100
changeset 151 69782399eb50
parent 150 73972df488d2
child 154 eaa2b6a4ead8
permissions -rw-r--r--
Ajout des corrections des exercices composites
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@151
   208
   subquiz+,
patrick@151
   209
   help?,
patrick@151
   210
   answer?
patrick@77
   211
patrick@85
   212
# ~~~~~~ subquiz
patrick@85
   213
subquiz = element subquiz { subquiz.content }
patrick@77
   214
patrick@85
   215
subquiz.content =
patrick@77
   216
   instructions?,
Patrick@141
   217
   engine,
Patrick@141
   218
   help?,
Patrick@141
   219
   answer?
patrick@73
   220
patrick@73
   221
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   222
patrick@73
   223
help = element help { help.content }
patrick@73
   224
patrick@73
   225
help.content =
patrick@73
   226
   (section+ | block+)?,
patrick@73
   227
   link*
patrick@73
   228
patrick@87
   229
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   230
patrick@87
   231
answer = element answer { answer.content }
patrick@73
   232
patrick@87
   233
answer.content =
patrick@81
   234
   (section+ | block+)?,
patrick@80
   235
   link*
patrick@73
   236
patrick@73
   237
patrick@73
   238
# =============================================================================
patrick@73
   239
#                                 BLOCK LEVEL
patrick@73
   240
# =============================================================================
patrick@73
   241
patrick@73
   242
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   243
patrick@73
   244
blanks.block =
patrick@73
   245
   (blanks.p | speech | blanks.list | blockquote | blanks.table | media)
patrick@73
   246
point.block =
patrick@73
   247
   (point.p | speech | point.list | blockquote | point.table | media)
patrick@73
   248
patrick@73
   249
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   250
patrick@73
   251
blanks.p = element p { blanks.p.content }
patrick@73
   252
point.p = element p { point.p.content }
patrick@73
   253
patrick@73
   254
blanks.p.content =
patrick@75
   255
   blanks.inlines
patrick@73
   256
point.p.content =
patrick@75
   257
   point.inlines
patrick@73
   258
patrick@73
   259
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   260
patrick@73
   261
# ~~~~~~ list
patrick@75
   262
blanks.list = element list {
patrick@73
   263
   block.head?,
patrick@73
   264
   (  (attribute type {"ordered"}?, blanks.item, blanks.item+)
patrick@73
   265
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   266
}
patrick@75
   267
point.list = element list {
patrick@73
   268
   block.head?,
patrick@73
   269
   (  (attribute type {"ordered"}?, point.item, point.item+)
patrick@73
   270
    | (attribute type {"glossary"}, glossary.item+) )
patrick@75
   271
}
patrick@73
   272
patrick@73
   273
# ~~~~~~ item
patrick@73
   274
blanks.item = element item { blanks.item.content }
patrick@73
   275
point.item = element item { point.item.content }
patrick@73
   276
patrick@73
   277
blanks.item.content =
patrick@75
   278
   blanks.inlines
patrick@73
   279
 | blanks.block+
patrick@73
   280
point.item.content =
patrick@75
   281
   point.inlines
patrick@73
   282
 | point.block+
patrick@73
   283
patrick@73
   284
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   285
patrick@73
   286
blanks.table = element table { blanks.table.content }
patrick@73
   287
point.table = element table { point.table.content }
patrick@73
   288
patrick@73
   289
blanks.table.content =
patrick@73
   290
   block.head?,
patrick@73
   291
   blanks.tgroup+,
patrick@111
   292
   table.caption?
patrick@73
   293
point.table.content =
patrick@73
   294
   block.head?,
patrick@73
   295
   point.tgroup+,
patrick@111
   296
   table.caption?
patrick@73
   297
patrick@73
   298
# ~~~~~~ tgroup
patrick@73
   299
blanks.tgroup = element tgroup { tgroup.attributes, blanks.tgroup.content }
patrick@73
   300
point.tgroup = element tgroup { tgroup.attributes, point.tgroup.content }
patrick@73
   301
patrick@73
   302
blanks.tgroup.content =
patrick@73
   303
   thead?,
patrick@73
   304
   blanks.tbody
patrick@73
   305
point.tgroup.content =
patrick@73
   306
   thead?,
patrick@73
   307
   point.tbody
patrick@73
   308
patrick@73
   309
# ~~~~~~ tbody
patrick@73
   310
blanks.tbody = element tbody { tbody.attributes, blanks.tbody.content }
patrick@73
   311
point.tbody = element tbody { tbody.attributes, point.tbody.content }
patrick@73
   312
patrick@73
   313
blanks.tbody.content =
patrick@73
   314
   blanks.row+
patrick@73
   315
point.tbody.content =
patrick@73
   316
   point.row+
patrick@73
   317
patrick@73
   318
# ~~~~~~ row
patrick@148
   319
blanks.row = element row { row.attributes, blanks.row.content }
patrick@148
   320
point.row = element row { row.attributes, point.row.content }
patrick@73
   321
patrick@73
   322
blanks.row.content =
patrick@73
   323
  blanks.entry+
patrick@73
   324
point.row.content =
patrick@73
   325
  point.entry+
patrick@73
   326
patrick@73
   327
# ~~~~~~ entry
patrick@73
   328
blanks.entry = element entry { blanks.entry.content }
patrick@73
   329
point.entry = element entry { point.entry.content }
patrick@73
   330
patrick@73
   331
blanks.entry.content =
patrick@75
   332
   blanks.inlines
patrick@73
   333
 | (p | media)+
patrick@73
   334
patrick@73
   335
point.entry.content =
patrick@75
   336
   point.inlines
patrick@73
   337
 | (p | media)+
patrick@73
   338
patrick@73
   339
patrick@73
   340
# ~~~~~~~~~~~~~~~~~~~~~~~~ choices.right, choices.wrong ~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   341
patrick@73
   342
choices.right = element right { choices.right.content }
patrick@73
   343
choices.wrong = element wrong { choices.right.content }
patrick@73
   344
patrick@73
   345
choices.right.content =
patrick@73
   346
   inlines
patrick@150
   347
 | (p+, help?, answer?)
patrick@73
   348
patrick@73
   349
patrick@73
   350
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks.wrongs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   351
patrick@73
   352
# ~~~~~~ blanks.wrongs
patrick@73
   353
blanks.wrongs = element wrongs { blanks.wrongs.content }
patrick@73
   354
patrick@73
   355
blanks.wrongs.content =
patrick@73
   356
   blanks.wrong+
patrick@73
   357
patrick@73
   358
# ~~~~~~ blanks.wrong
patrick@73
   359
blanks.wrong = element wrong { blanks.wrong.content }
patrick@73
   360
patrick@73
   361
blanks.wrong.content = text
patrick@73
   362
patrick@150
   363
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ match ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   364
patrick@73
   365
match = element match { match.content }
patrick@73
   366
patrick@73
   367
match.content =
patrick@73
   368
   (p | section),
patrick@73
   369
   (p | section)
patrick@73
   370
patrick@75
   371
# ~~~~~~~~~~~~~~~~~~~~~~~~ (sort) comparison, item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   372
patrick@73
   373
# ~~~~~~ comparison
patrick@73
   374
comparison = element comparison { comparison.content }
patrick@73
   375
patrick@73
   376
comparison.content = inlines
patrick@73
   377
patrick@73
   378
# ~~~~~~ sort.item
patrick@73
   379
sort.item = element item { sort.item.attributes, sort.item.content }
patrick@73
   380
patrick@73
   381
sort.item.attributes =
patrick@73
   382
   item.shuffle.attribute?
patrick@73
   383
item.shuffle.attribute = attribute shuffle { xsd:integer }
patrick@73
   384
patrick@73
   385
sort.item.content = inlines
patrick@73
   386
patrick@125
   387
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (category) item ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@125
   388
patrick@125
   389
# ~~~~~~ category.item
patrick@125
   390
category.item = element item { category.item.content }
patrick@125
   391
patrick@125
   392
category.item.content = inlines
patrick@125
   393
patrick@73
   394
patrick@73
   395
# =============================================================================
patrick@73
   396
#                                 INLINE LEVEL
patrick@73
   397
# =============================================================================
patrick@73
   398
patrick@75
   399
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@75
   400
patrick@75
   401
blanks.inlines = mixed {
patrick@75
   402
   sup*
patrick@75
   403
 & sub*
patrick@75
   404
 & var*
patrick@75
   405
 & number*
patrick@75
   406
 & math*
patrick@75
   407
 & date*
patrick@75
   408
 & name*
patrick@75
   409
 & note*
patrick@75
   410
 & foreign*
patrick@75
   411
 & highlight*
patrick@75
   412
 & mentioned*
patrick@75
   413
 & quote*
patrick@75
   414
 & acronym*
patrick@75
   415
 & term*
patrick@75
   416
 & link*
patrick@75
   417
 & anchor*
patrick@75
   418
 & blank*
patrick@75
   419
}
patrick@75
   420
point.inlines = mixed {
patrick@75
   421
   sup*
patrick@75
   422
 & sub*
patrick@75
   423
 & var*
patrick@75
   424
 & number*
patrick@75
   425
 & math*
patrick@75
   426
 & date*
patrick@75
   427
 & name*
patrick@75
   428
 & note*
patrick@75
   429
 & foreign*
patrick@75
   430
 & highlight*
patrick@75
   431
 & mentioned*
patrick@75
   432
 & quote*
patrick@75
   433
 & acronym*
patrick@75
   434
 & term*
patrick@75
   435
 & link*
patrick@75
   436
 & anchor*
patrick@75
   437
 & blank*
patrick@75
   438
 & point.right*
patrick@75
   439
 & point.wrong*
patrick@75
   440
}
patrick@75
   441
patrick@73
   442
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blank ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   443
patrick@73
   444
# ~~~~~~ blank
patrick@73
   445
blank = element blank { blank.content }
patrick@73
   446
patrick@73
   447
blank.content =
patrick@73
   448
   text
patrick@87
   449
 | (s+, help?, answer?)
patrick@73
   450
patrick@73
   451
# ~~~~~~ s
patrick@73
   452
s = element s { s.content }
patrick@73
   453
patrick@73
   454
s.content = text
patrick@73
   455
patrick@73
   456
# ~~~~~~~~~~~~~~~~~~~~~~~~~ point.right, point.wrong ~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@73
   457
patrick@73
   458
point.right = element right { point.right.content }
patrick@73
   459
point.wrong = element wrong { point.right.content }
patrick@73
   460
patrick@73
   461
point.right.content = inlines