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