RelaxNG/publidoc.rnc
changeset 18 e448c6a000e5
parent 17 ca367d4d080b
child 20 79713ffae179
equal deleted inserted replaced
17:ca367d4d080b 18:e448c6a000e5
    28 document.attributes =
    28 document.attributes =
    29    document.id.attribute
    29    document.id.attribute
    30 document.id.attribute = attribute xml:id { xsd:ID }
    30 document.id.attribute = attribute xml:id { xsd:ID }
    31 
    31 
    32 document.content =
    32 document.content =
    33    metadata?,
    33    top.metadata?,
    34    (division+ | topic+)
    34    (division+ | topic+)
    35 
    35 
    36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    37 
    37 
    38 top.topic = element topic { top.topic.attributes, topic.content }
    38 top.topic = element topic { top.topic.attributes, top.topic.content }
    39 
    39 
    40 
    40 
    41 # =============================================================================
    41 # =============================================================================
    42 #                               Metadata level
    42 #                               Metadata level
    43 # =============================================================================
    43 # =============================================================================
    44 
    44 
    45 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    45 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    46 
    46 
    47 metadata = element metadata { metadata.content }
    47 top.metadata = element metadata { top.metadata.content }
    48 
    48 division.metadata = element metadata { division.metadata.content }
    49 metadata.content =
    49 component.metadata = element metadata { component.metadata.content }
    50    title
    50 section.metadata = element metadata { section.metadata.content }
    51  & subtitle?
    51 
       
    52 top.metadata.content =
       
    53    (title, subtitle?)?
       
    54  & language?
    52  & author*
    55  & author*
    53  & publisher?
    56  & publisher?
    54  & language?
       
    55  & date?
    57  & date?
    56  & place?
    58  & place?
    57  & source*
    59  & source*
    58  & subjectset?
    60  & subjectset?
    59  & abstract?
    61  & abstract?
    60  & annotation*
    62  & annotation*
       
    63 division.metadata.content =
       
    64    (title, subtitle?)?
       
    65  & language?
       
    66  & annotation*
       
    67 component.metadata.content =
       
    68    (title, subtitle?)?
       
    69  & language?
       
    70  & author*
       
    71  & annotation*
       
    72 section.metadata.content =
       
    73    (title, subtitle?)?
       
    74  & language?
       
    75  & annotation*
    61 
    76 
    62 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    77 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    63 
    78 
    64 title = element title { title.content }
    79 title = element title { title.content }
       
    80 subtitle = element subtitle { title.content }
    65 
    81 
    66 title.content = inlines
    82 title.content = inlines
    67 
    83 
    68 subtitle = element subtitle { title.content }
    84 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    85 
       
    86 language = element language { language.attributes }
       
    87 
       
    88 language.attributes = lang.attribute
       
    89 lang.attribute = attribute xml:lang { xsd:language }
    69 
    90 
    70 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    91 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    71 
    92 
    72 # ~~~~~~ author
    93 # ~~~~~~ author
    73 author = element author { author.content }
    94 author = element author { author.content }
    88 
   109 
    89 # ~~~~~~ lastname
   110 # ~~~~~~ lastname
    90 lastname = element lastname { lastname.content }
   111 lastname = element lastname { lastname.content }
    91 
   112 
    92 lastname.content = inlines
   113 lastname.content = inlines
    93 
       
    94 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    95 
       
    96 language = element language { language.attributes }
       
    97 
       
    98 language.attributes = lang.attribute
       
    99 lang.attribute = attribute xml:lang { xsd:language }
       
   100 
   114 
   101 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   115 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   102 
   116 
   103 place = element place { place.content }
   117 place = element place { place.content }
   104 
   118 
   167 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   181 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   168 
   182 
   169 division = element division { division.content }
   183 division = element division { division.content }
   170 
   184 
   171 division.content =
   185 division.content =
   172    metadata?,
   186    division.metadata?,
   173    (division+ | topic+)
   187    (division+ | topic+)
   174 
   188 
   175 
   189 
   176 # =============================================================================
   190 # =============================================================================
   177 #                               Component level
   191 #                               Component level
   188    topic.id.attribute?
   202    topic.id.attribute?
   189  & topic.type.attribute?
   203  & topic.type.attribute?
   190 topic.id.attribute = attribute xml:id { xsd:ID }
   204 topic.id.attribute = attribute xml:id { xsd:ID }
   191 topic.type.attribute = attribute type { xsd:NCName }
   205 topic.type.attribute = attribute type { xsd:NCName }
   192 
   206 
       
   207 top.topic.content =
       
   208    top.metadata?,
       
   209    section+
   193 topic.content =
   210 topic.content =
   194    metadata?,
   211    component.metadata?,
   195    section+
   212    section+
   196 
   213 
   197 
   214 
   198 # =============================================================================
   215 # =============================================================================
   199 #                                 Section level
   216 #                                 Section level
   202 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   219 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   203 
   220 
   204 section = element section { section.content, section.attributes }
   221 section = element section { section.content, section.attributes }
   205 
   222 
   206 section.content =
   223 section.content =
   207    metadata?,
   224    section.metadata?,
   208    (section+ | block+)
   225    (section+ | block+)
   209 
   226 
   210 section.attributes =
   227 section.attributes =
   211    status.attribute?
   228    status.attribute?
   212 status.attribute = attribute status { xsd:NCName }
   229 status.attribute = attribute status { xsd:NCName }
   216 #                                 Block level
   233 #                                 Block level
   217 # =============================================================================
   234 # =============================================================================
   218 
   235 
   219 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   236 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   220 
   237 
   221 block = (parag | \list | table | speech | media)
   238 block = (parag | speech | \list | table | media)
   222 
   239 
   223 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   240 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   224 
   241 
   225 parag = element parag { parag.content }
   242 parag = element parag { parag.content }
   226 
   243 
   227 parag.content =
   244 parag.content =
   228    inlines
   245    inlines
   229  & link*
   246  & link*
       
   247 
       
   248 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   249 
       
   250 # ~~~~~~ speech
       
   251 speech = element speech { speech.content }
       
   252 
       
   253 speech.content =
       
   254    speaker?,
       
   255    stage?,
       
   256    parag+
       
   257 
       
   258 # ~~~~~~ speaker
       
   259 speaker = element speaker { speaker.content }
       
   260 
       
   261 speaker.content = inlines
       
   262 
       
   263 # ~~~~~~ stage
       
   264 stage = element stage { stage.content }
       
   265 
       
   266 stage.content = inlines
   230 
   267 
   231 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   268 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   232 
   269 
   233 # ~~~~~~ list
   270 # ~~~~~~ list
   234 \list = element list { \list.content }
   271 \list = element list { \list.content }
   314 # ~~~~~~ caption
   351 # ~~~~~~ caption
   315 caption = element caption { caption.content }
   352 caption = element caption { caption.content }
   316 
   353 
   317 caption.content =
   354 caption.content =
   318    parag+
   355    parag+
   319 
       
   320 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   321 
       
   322 # ~~~~~~ speech
       
   323 speech = element speech { speech.content }
       
   324 
       
   325 speech.content =
       
   326    speaker?,
       
   327    stage?,
       
   328    parag+
       
   329 
       
   330 # ~~~~~~ speaker
       
   331 speaker = element speaker { speaker.content }
       
   332 
       
   333 speaker.content = inlines
       
   334 
       
   335 # ~~~~~~ stage
       
   336 stage = element stage { stage.content }
       
   337 
       
   338 stage.content = inlines
       
   339 
   356 
   340 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   357 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   341 
   358 
   342 # ~~~~~~ media
   359 # ~~~~~~ media
   343 media = element media { media.content }
   360 media = element media { media.content }