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