RelaxNG/publiquiz.rnc
changeset 87 35606ecc54fc
parent 85 deac30469ca6
child 111 44de27e5c6cf
equal deleted inserted replaced
86:2d51a1795ed3 87:35606ecc54fc
    54 quiz.id.attribute = attribute xml:id { xsd:ID }
    54 quiz.id.attribute = attribute xml:id { xsd:ID }
    55 
    55 
    56 quiz.content =
    56 quiz.content =
    57    component.head?,
    57    component.head?,
    58    instructions,
    58    instructions,
    59    (engine | composite)?,
    59    (engine | composite),
    60    help?,
    60    help?,
    61    commentary?
    61    answer?
    62 
    62 
    63 
    63 
    64 # =============================================================================
    64 # =============================================================================
    65 #                                 SECTION LEVEL
    65 #                                 SECTION LEVEL
    66 # =============================================================================
    66 # =============================================================================
    82 instructions = element instructions { section.content }
    82 instructions = element instructions { section.content }
    83 
    83 
    84 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ engine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    84 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ engine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    85 
    85 
    86 engine =
    86 engine =
    87    choices
    87    choices-radio
    88  | blanks
    88  | choices-check
       
    89  | blanks-fill
       
    90  | blanks-select
    89  | point
    91  | point
    90  | matching
    92  | matching
    91  | sort
    93  | sort
       
    94  | production
    92 
    95 
    93 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ choices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    96 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ choices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    94 
    97 
    95 choices = element choices {
    98 choices-radio = element choices-radio {
    96    (attribute type {"radio"}, choices.attributes, choices.radio.content)
    99    choices.attributes, choices-radio.content }
    97  | (attribute type {"check"}, choices.attributes, choices.check.content)
   100 choices-check = element choices-check {
    98 }
   101    choices.attributes, choices-check.content }
    99 
   102 
   100 choices.attributes =
   103 choices.attributes =
   101    shuffle.attribute?
   104    shuffle.attribute?
   102 shuffle.attribute = attribute shuffle { xsd:boolean }
   105 shuffle.attribute = attribute shuffle { xsd:boolean }
   103 
   106 
   104 choices.radio.content =
   107 choices-radio.content =
   105    choices.right
   108    choices.right
   106  & choices.wrong+
   109  & choices.wrong+
   107 choices.check.content =
   110 choices-check.content =
   108    (choices.right | choices.wrong)+
   111    (choices.right | choices.wrong)+
   109 
   112 
   110 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   113 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blanks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   111 
   114 
   112 blanks = element blanks {
   115 blanks-fill = element blanks-fill {
   113    (attribute type {"fill"}, blanks.fill.attributes, blanks.fill.content)
   116    blanks-fill.attributes, blanks-fill.content }
   114  | (attribute type {"select"}, blanks.select.attributes, blanks.select.content)
   117 blanks-select = element blanks-select {
   115 }
   118    blanks-select.attributes, blanks-select.content }
   116 
   119 
   117 blanks.fill.attributes =
   120 blanks-fill.attributes =
   118    strict.attribute?
   121    strict.attribute?
   119 blanks.select.attributes =
   122 blanks-select.attributes =
   120    multiple.attribute?
   123    multiple.attribute?
   121 strict.attribute = attribute strict { xsd:boolean }
   124 strict.attribute = attribute strict { xsd:boolean }
   122 multiple.attribute = attribute multiple { xsd:boolean }
   125 multiple.attribute = attribute multiple { xsd:boolean }
   123 
   126 
   124 blanks.fill.content =
   127 blanks-fill.content =
   125    (blanks.block+ | blanks.section+)
   128    (blanks.block+ | blanks.section+)
   126 blanks.select.content =
   129 blanks-select.content =
   127    blanks.wrongs?,
   130    blanks.wrongs?,
   128    (blanks.block+ | blanks.section+)
   131    (blanks.block+ | blanks.section+)
   129 
   132 
   130 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   133 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   131 
   134 
   157 sort.content =
   160 sort.content =
   158    comparison?,
   161    comparison?,
   159    sort.item,
   162    sort.item,
   160    sort.item+
   163    sort.item+
   161 
   164 
       
   165 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ production ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   166 
       
   167 production = element production { empty }
       
   168 
   162 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composite ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   169 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composite ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   163 
   170 
   164 # ~~~~~~ composite
   171 # ~~~~~~ composite
   165 composite = element composite { composite.content }
   172 composite = element composite { composite.content }
   166 
   173 
   181 
   188 
   182 help.content =
   189 help.content =
   183    (section+ | block+)?,
   190    (section+ | block+)?,
   184    link*
   191    link*
   185 
   192 
   186 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ commentary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   187 
   194 
   188 commentary = element commentary { commentary.content }
   195 answer = element answer { answer.content }
   189 
   196 
   190 commentary.content =
   197 answer.content =
   191    (section+ | block+)?,
   198    (section+ | block+)?,
   192    link*
   199    link*
   193 
   200 
   194 
   201 
   195 # =============================================================================
   202 # =============================================================================
   394 # ~~~~~~ blank
   401 # ~~~~~~ blank
   395 blank = element blank { blank.content }
   402 blank = element blank { blank.content }
   396 
   403 
   397 blank.content =
   404 blank.content =
   398    text
   405    text
   399  | (s+, help?, commentary?)
   406  | (s+, help?, answer?)
   400 
   407 
   401 # ~~~~~~ s
   408 # ~~~~~~ s
   402 s = element s { s.content }
   409 s = element s { s.content }
   403 
   410 
   404 s.content = text
   411 s.content = text