RelaxNG/publidoc.rnc
changeset 20 79713ffae179
parent 18 e448c6a000e5
child 22 94b8e4454c47
equal deleted inserted replaced
19:7141fd097b97 20:79713ffae179
    16    document
    16    document
    17  | top.topic
    17  | top.topic
    18 
    18 
    19 
    19 
    20 # =============================================================================
    20 # =============================================================================
    21 #                                  Top level
    21 #                                  TOP LEVEL
    22 # =============================================================================
    22 # =============================================================================
    23 
    23 
    24 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    24 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    25 
    25 
    26 document = element document { document.attributes, document.content }
    26 document = element document { document.attributes, document.content }
    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    top.metadata?,
    33    top.head?,
    34    (division+ | topic+)
    34    (division+ | topic+)
    35 
    35 
    36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    37 
    37 
    38 top.topic = element topic { top.topic.attributes, top.topic.content }
    38 top.topic = element topic { top.topic.attributes, top.topic.content }
    39 
    39 
    40 
    40 top.topic.attributes =
    41 # =============================================================================
    41    topic.id.attribute
    42 #                               Metadata level
    42  & topic.type.attribute?
    43 # =============================================================================
    43 topic.id.attribute = attribute xml:id { xsd:ID }
    44 
    44 topic.type.attribute = attribute type { xsd:NCName }
    45 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    45 
    46 
    46 top.topic.content =
    47 top.metadata = element metadata { top.metadata.content }
    47    top.head?,
    48 division.metadata = element metadata { division.metadata.content }
    48    section+
    49 component.metadata = element metadata { component.metadata.content }
    49 
    50 section.metadata = element metadata { section.metadata.content }
    50 # =============================================================================
    51 
    51 #                                 HEAD LEVEL
    52 top.metadata.content =
    52 # =============================================================================
       
    53 
       
    54 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    55 
       
    56 top.head = element head { top.head.content }
       
    57 division.head = element head { division.head.content }
       
    58 component.head = element head { component.head.content }
       
    59 section.head = element head { section.head.content }
       
    60 block.head = element head { block.head.content }
       
    61 
       
    62 top.head.content =
    53    (title, subtitle?)?
    63    (title, subtitle?)?
    54  & language?
    64  & language?
    55  & author*
    65  & author*
    56  & publisher?
    66  & publisher?
    57  & date?
    67  & date?
    58  & place?
    68  & place?
    59  & source*
    69  & source*
    60  & subjectset?
    70  & subjectset?
    61  & abstract?
    71  & abstract?
    62  & annotation*
    72  & annotation*
    63 division.metadata.content =
    73 division.head.content =
    64    (title, subtitle?)?
    74    (title, subtitle?)?
    65  & language?
    75  & language?
    66  & annotation*
    76  & annotation*
    67 component.metadata.content =
    77 component.head.content =
    68    (title, subtitle?)?
    78    (title, subtitle?)?
    69  & language?
    79  & language?
    70  & author*
    80  & author*
    71  & annotation*
    81  & annotation*
    72 section.metadata.content =
    82 section.head.content =
    73    (title, subtitle?)?
    83    (title, subtitle?)?
    74  & language?
    84  & language?
    75  & annotation*
    85  & annotation*
       
    86 block.head.content =
       
    87    (title, subtitle?)?
    76 
    88 
    77 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    89 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    78 
    90 
    79 title = element title { title.content }
    91 title = element title { title.content }
    80 subtitle = element subtitle { title.content }
    92 subtitle = element subtitle { title.content }
   163 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   175 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   164 
   176 
   165 abstract = element abstract { abstract.content }
   177 abstract = element abstract { abstract.content }
   166 
   178 
   167 abstract.content =
   179 abstract.content =
   168    parag+
   180    p+
   169 
   181 
   170 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   182 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   171 
   183 
   172 annotation = element annotation { annotation.content }
   184 annotation = element annotation { annotation.content }
   173 
   185 
   174 annotation.content = inlines
   186 annotation.content = inlines
   175 
   187 
   176 
   188 
   177 # =============================================================================
   189 # =============================================================================
   178 #                                 Division level
   190 #                                 DIVISION LEVEL
   179 # =============================================================================
   191 # =============================================================================
   180 
   192 
   181 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   182 
   194 
   183 division = element division { division.content }
   195 division = element division { division.content }
   184 
   196 
   185 division.content =
   197 division.content =
   186    division.metadata?,
   198    division.head?,
   187    (division+ | topic+)
   199    (division+ | topic+)
   188 
   200 
   189 
   201 
   190 # =============================================================================
   202 # =============================================================================
   191 #                               Component level
   203 #                               COMPONENT LEVEL
   192 # =============================================================================
   204 # =============================================================================
   193 
   205 
   194 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   206 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   195 
   207 
   196 topic = element topic { topic.attributes, topic.content }
   208 topic = element topic { topic.attributes, topic.content }
   197 
   209 
   198 top.topic.attributes =
       
   199    topic.id.attribute
       
   200  & topic.type.attribute?
       
   201 topic.attributes =
   210 topic.attributes =
   202    topic.id.attribute?
   211    topic.id.attribute?
   203  & topic.type.attribute?
   212  & topic.type.attribute?
   204 topic.id.attribute = attribute xml:id { xsd:ID }
   213 
   205 topic.type.attribute = attribute type { xsd:NCName }
   214 topic.content =
   206 
   215    component.head?,
   207 top.topic.content =
       
   208    top.metadata?,
       
   209    section+
   216    section+
   210 topic.content =
   217 
   211    component.metadata?,
   218 
   212    section+
   219 # =============================================================================
   213 
   220 #                                 SECTION LEVEL
   214 
   221 # =============================================================================
   215 # =============================================================================
   222 
   216 #                                 Section level
   223 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   217 # =============================================================================
       
   218 
       
   219 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   220 
   224 
   221 section = element section { section.content, section.attributes }
   225 section = element section { section.content, section.attributes }
   222 
   226 
   223 section.content =
   227 section.content =
   224    section.metadata?,
   228    section.head?,
   225    (section+ | block+)
   229    (section+ | block+)
   226 
   230 
   227 section.attributes =
   231 section.attributes =
   228    status.attribute?
   232    status.attribute?
   229 status.attribute = attribute status { xsd:NCName }
   233 status.attribute = attribute status { xsd:NCName }
   230 
   234 
   231 
   235 
   232 # =============================================================================
   236 # =============================================================================
   233 #                                 Block level
   237 #                                 BLOCK LEVEL
   234 # =============================================================================
   238 # =============================================================================
   235 
   239 
   236 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   240 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ block ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   237 
   241 
   238 block = (parag | speech | \list | table | media)
   242 block = (p | speech | \list | table | media)
   239 
   243 
   240 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   244 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   241 
   245 
   242 parag = element parag { parag.content }
   246 p = element p { p.content }
   243 
   247 
   244 parag.content =
   248 p.content =
   245    inlines
   249    inlines
   246  & link*
   250  & link*
   247 
   251 
   248 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   252 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ speech ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   249 
   253 
   251 speech = element speech { speech.content }
   255 speech = element speech { speech.content }
   252 
   256 
   253 speech.content =
   257 speech.content =
   254    speaker?,
   258    speaker?,
   255    stage?,
   259    stage?,
   256    parag+
   260    p+
   257 
   261 
   258 # ~~~~~~ speaker
   262 # ~~~~~~ speaker
   259 speaker = element speaker { speaker.content }
   263 speaker = element speaker { speaker.content }
   260 
   264 
   261 speaker.content = inlines
   265 speaker.content = inlines
   269 
   273 
   270 # ~~~~~~ list
   274 # ~~~~~~ list
   271 \list = element list { \list.content }
   275 \list = element list { \list.content }
   272 
   276 
   273 \list.content =
   277 \list.content =
   274    title?,
   278    block.head?,
   275    (  (attribute type {"ordered"} ?, item, item+)
   279    (  (attribute type {"ordered"} ?, item, item+)
   276     | (attribute type {"glossary"}, glossary.item+) )
   280     | (attribute type {"glossary"}, glossary.item+) )
   277 
   281 
   278 # ~~~~~~ item
   282 # ~~~~~~ item
   279 item = element item { item.content }
   283 item = element item { item.content }
   295 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   299 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   296 
   300 
   297 table = element table { table.content }
   301 table = element table { table.content }
   298 
   302 
   299 table.content =
   303 table.content =
   300    title?,
   304    block.head?,
   301    tgroup+,
   305    tgroup+,
   302    caption?
   306    caption?
   303 
   307 
   304 # ~~~~~~ tgroup
   308 # ~~~~~~ tgroup
   305 tgroup = element tgroup { tgroup.attributes, tgroup.content }
   309 tgroup = element tgroup { tgroup.attributes, tgroup.content }
   344 # ~~~~~~ entry
   348 # ~~~~~~ entry
   345 entry = element entry { entry.content }
   349 entry = element entry { entry.content }
   346 
   350 
   347 entry.content =
   351 entry.content =
   348    inlines
   352    inlines
   349  | parag+
   353  | p+
   350 
   354 
   351 # ~~~~~~ caption
   355 # ~~~~~~ caption
   352 caption = element caption { caption.content }
   356 caption = element caption { caption.content }
   353 
   357 
   354 caption.content =
   358 caption.content =
   355    parag+
   359    inlines
       
   360  | p+
   356 
   361 
   357 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   362 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   358 
   363 
   359 # ~~~~~~ media
   364 # ~~~~~~ media
   360 media = element media { media.content }
   365 media = element media { media.content }
   378 
   383 
   379 copyright.content = inlines
   384 copyright.content = inlines
   380 
   385 
   381 
   386 
   382 # =============================================================================
   387 # =============================================================================
   383 #                                 Inline level
   388 #                                 INLINE LEVEL
   384 # =============================================================================
   389 # =============================================================================
   385 
   390 
   386 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   391 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   387 
   392 
   388 inlines = mixed {
   393 inlines = mixed {
   452    note.label.attribute?
   457    note.label.attribute?
   453 note.label.attribute = attribute label { text }
   458 note.label.attribute = attribute label { text }
   454 
   459 
   455 note.content =
   460 note.content =
   456    inlines
   461    inlines
   457  | parag+
   462  | p+
   458 
   463 
   459 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   464 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   460 
   465 
   461 foreign = element foreign { foreign.attributes, foreign.content }
   466 foreign = element foreign { foreign.attributes, foreign.content }
   462 
   467