RelaxNG/publidoc.rnc
changeset 419 9ee9258144c5
parent 416 544199d43060
child 423 0b803d5f38d4
equal deleted inserted replaced
418:2c303e23577d 419:9ee9258144c5
    13 version.attribute = attribute version { "1.0" }
    13 version.attribute = attribute version { "1.0" }
    14 
    14 
    15 publidoc.content =
    15 publidoc.content =
    16    document
    16    document
    17  | top.topic
    17  | top.topic
    18 
    18  | glossary
    19 
    19 
    20 # =============================================================================
    20 # =============================================================================
    21 #                                 HEAD LEVEL
    21 #                                 HEAD LEVEL
    22 # =============================================================================
    22 # =============================================================================
    23 
    23 
   224 document.type.attribute = attribute type { xsd:NCName }
   224 document.type.attribute = attribute type { xsd:NCName }
   225 lang.attribute = attribute xml:lang { xsd:language }
   225 lang.attribute = attribute xml:lang { xsd:language }
   226 
   226 
   227 document.content =
   227 document.content =
   228    top.head?,
   228    top.head?,
   229    (division | topic)+
   229    (division | topic | glossary)+
   230 
   230 
   231 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   231 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top.topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   232 
   232 
   233 top.topic = element topic { top.topic.attributes, top.topic.content }
   233 top.topic = element topic { top.topic.attributes, top.topic.content }
   234 
   234 
   242 top.topic.content =
   242 top.topic.content =
   243    top.head?,
   243    top.head?,
   244    header?,
   244    header?,
   245    ((section+, bibliography?) | bibliography),
   245    ((section+, bibliography?) | bibliography),
   246    footer?
   246    footer?
       
   247 
       
   248 
       
   249 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glossary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   250 
       
   251 glossary = element glossary { glossary.attributes, glossary.content }
       
   252 
       
   253 glossary.attributes =
       
   254    glossary.type.attribute?
       
   255  & langfrom.attribute?
       
   256  & langto.attribute?
       
   257 glossary.type.attribute = attribute type { xsd:NCName }
       
   258 langfrom.attribute = attribute langfrom { xsd:language }
       
   259 langto.attribute = attribute langto { xsd:language }
       
   260 
       
   261 glossary.content =
       
   262    glossary.entry+
   247 
   263 
   248 
   264 
   249 # =============================================================================
   265 # =============================================================================
   250 #                                 DIVISION LEVEL
   266 #                                 DIVISION LEVEL
   251 # =============================================================================
   267 # =============================================================================
   369 footer = element footer { footer.content }
   385 footer = element footer { footer.content }
   370 
   386 
   371 footer.content =
   387 footer.content =
   372    block+
   388    block+
   373 
   389 
       
   390 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glossary.entry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   391 # ~~~~~~ glossary.entry
       
   392 glossary.entry= element entry {
       
   393    glossary.entry.attributes, glossary.entry.content }
       
   394 
       
   395 glossary.entry.attributes =
       
   396    xmlid.attribute
       
   397 
       
   398 glossary.entry.content =
       
   399    mainterm,
       
   400    meanings+,
       
   401    seealso*
       
   402 
       
   403 # ~~~~~~ mainterm
       
   404 mainterm = element mainterm { mainterm.content }
       
   405 mainterm.content = simple.inlines
   374 
   406 
   375 # =============================================================================
   407 # =============================================================================
   376 #                                 BLOCK LEVEL
   408 #                                 BLOCK LEVEL
   377 # =============================================================================
   409 # =============================================================================
   378 
   410 
   400 
   432 
   401 # ~~~~~~ list
   433 # ~~~~~~ list
   402 \list = element list {
   434 \list = element list {
   403    block.head?,
   435    block.head?,
   404    (  (attribute type {"ordered"}?, item, item+)
   436    (  (attribute type {"ordered"}?, item, item+)
   405     | (attribute type {"glossary"}, glossary.item+) )
   437     | (attribute type {"glossary"}, item.glossary+) )
   406 }
   438 }
   407 
   439 
   408 # ~~~~~~ item
   440 # ~~~~~~ item
   409 item = element item { item.content }
   441 item = element item { item.content }
   410 
   442 
   411 item.content =
   443 item.content =
   412    inlines
   444    inlines
   413  | block+
   445  | block+
   414 
   446 
   415 # ~~~~~~ glossary.item
   447 # ~~~~~~ item.glossary
   416 glossary.item = element item { glossary.item.content }
   448 item.glossary = element item { item.glossary.content }
   417 
   449 
   418 glossary.item.content =
   450 item.glossary.content =
   419    label,
   451    label,
   420    block+
   452    block+
   421 
   453 
   422 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   454 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ blockquote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   423 
   455 
   716 # ~~~~~~ pages
   748 # ~~~~~~ pages
   717 pages = element pages { pages.content }
   749 pages = element pages { pages.content }
   718 
   750 
   719 pages.content = xsd:positiveInteger
   751 pages.content = xsd:positiveInteger
   720 
   752 
       
   753 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ meanings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   754 
       
   755 # ~~~~~~ meanings
       
   756 meanings = element meanings { meanings.attributes, meanings.content }
       
   757 
       
   758 meanings.attributes =
       
   759    gramcode.attribute?
       
   760 gramcode.attribute = attribute gramcode { xsd:NMTOKEN }
       
   761 
       
   762 meanings.content =
       
   763    female?,
       
   764    plural?,
       
   765    meaning+
       
   766 
       
   767 # ~~~~~~ female, plural
       
   768 female = element female { inlines }
       
   769 plural = element plural { inlines }
       
   770 
       
   771 # ~~~~~~ meaning
       
   772 meaning = element meaning { meaning.attributes, meaning.content }
       
   773 
       
   774 meaning.attributes =
       
   775    meaning.domain.attribute?
       
   776  & langlevel.attribute?
       
   777 meaning.domain.attribute = attribute domain { xsd:NMTOKEN }
       
   778 langlevel.attribute = attribute langlevel { xsd:NMTOKEN }
       
   779 
       
   780 meaning.content =
       
   781    ((definition, example*, synonym*, antonym*, translation*)
       
   782     | (definition?, example*, synonym*, antonym*, translation+)
       
   783     | (definition?, example*, synonym+, antonym*, translation*)
       
   784     | (definition?, example*, synonym*, antonym+, translation*)),
       
   785    dictum*
       
   786 
       
   787 # ~~~~~~ definition
       
   788 definition = element definition { inlines }
       
   789 
       
   790 # ~~~~~~ synonym, antonym
       
   791 synonym = element synonym { simple.inlines }
       
   792 antonym = element antonym { simple.inlines }
       
   793 
       
   794 # ~~~~~~ translation
       
   795 translation = element translation { simple.inlines }
       
   796 
       
   797 # ~~~~~~ dictum
       
   798 dictum = element dictum { inlines }
       
   799 
       
   800 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ seealso ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   801 
       
   802 seealso = element seealso { seealso.attributes }
       
   803 
       
   804 seealso.attributes =
       
   805    gloss.ref.attribute
       
   806 
   721 
   807 
   722 # =============================================================================
   808 # =============================================================================
   723 #                                 INLINE LEVEL
   809 #                                 INLINE LEVEL
   724 # =============================================================================
   810 # =============================================================================
   725 
   811 
   745  & highlight*
   831  & highlight*
   746  & emphasis*
   832  & emphasis*
   747  & mentioned*
   833  & mentioned*
   748  & literal*
   834  & literal*
   749  & term*
   835  & term*
       
   836  & example*
   750  & stage*
   837  & stage*
   751  & name*
   838  & name*
   752  & foreign*
   839  & foreign*
   753  & date*
   840  & date*
   754  & math*
   841  & math*
   756  & initial*
   843  & initial*
   757  & note*
   844  & note*
   758  & link*
   845  & link*
   759  & anchor*
   846  & anchor*
   760  & index*
   847  & index*
       
   848  & gloss*
   761  & image*
   849  & image*
   762  & audio*
   850  & audio*
   763  & smil*
   851  & smil*
   764 }
   852 }
   765 
   853 
   818 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   906 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ term ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   819 
   907 
   820 term = element term { term.content }
   908 term = element term { term.content }
   821 
   909 
   822 term.content = mixed { sup* & warning* }
   910 term.content = mixed { sup* & warning* }
       
   911 
       
   912 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   913 
       
   914 example = element example { example.content }
       
   915    
       
   916 example.content = inlines
   823 
   917 
   824 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   918 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   825 
   919 
   826 stage = element stage { stage.content }
   920 stage = element stage { stage.content }
   827 
   921 
   938 anchor.attributes =
  1032 anchor.attributes =
   939    anchor.id.attribute
  1033    anchor.id.attribute
   940 anchor.id.attribute = attribute xml:id { xsd:ID }
  1034 anchor.id.attribute = attribute xml:id { xsd:ID }
   941 
  1035 
   942 anchor.content = simple.inlines
  1036 anchor.content = simple.inlines
       
  1037 
       
  1038 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gloss ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
  1039 
       
  1040 gloss = element gloss { gloss.attributes, gloss.content }
       
  1041 
       
  1042 gloss.attributes =
       
  1043    gloss.ref.attribute
       
  1044 gloss.ref.attribute = attribute ref { xsd:NCName }
       
  1045 
       
  1046 gloss.content = simple.inlines
   943 
  1047 
   944 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1048 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ smil ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   945 
  1049 
   946 smil = element smil { smil.attributes, smil.content }
  1050 smil = element smil { smil.attributes, smil.content }
   947 
  1051