RelaxNG/publidoc.rng
changeset 0 41a5385c69a2
child 2 417bb62f2a77
equal deleted inserted replaced
-1:000000000000 0:41a5385c69a2
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
       
     3   <!-- $Id$ -->
       
     4   <start>
       
     5     <ref name="publidoc"/>
       
     6   </start>
       
     7   <define name="publidoc">
       
     8     <element name="publidoc">
       
     9       <ref name="publidoc.attributes"/>
       
    10       <ref name="publidoc.content"/>
       
    11     </element>
       
    12   </define>
       
    13   <!-- ~~~~~~ attributes -->
       
    14   <define name="publidoc.attributes">
       
    15     <ref name="version.attribute"/>
       
    16   </define>
       
    17   <define name="version.attribute">
       
    18     <attribute name="version">
       
    19       <value>1.0</value>
       
    20     </attribute>
       
    21   </define>
       
    22   <!-- ~~~~~~ content -->
       
    23   <define name="publidoc.content">
       
    24     <choice>
       
    25       <ref name="document"/>
       
    26       <ref name="top.topic"/>
       
    27     </choice>
       
    28   </define>
       
    29   <!--
       
    30     =============================================================================
       
    31                                      Top level
       
    32     =============================================================================
       
    33   -->
       
    34   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
    35   <define name="document">
       
    36     <element name="document">
       
    37       <ref name="document.attributes"/>
       
    38       <ref name="document.content"/>
       
    39     </element>
       
    40   </define>
       
    41   <!-- ~~~~~~ attributes -->
       
    42   <define name="document.attributes">
       
    43     <ref name="document.id.attribute"/>
       
    44   </define>
       
    45   <define name="document.id.attribute">
       
    46     <attribute name="xml:id">
       
    47       <data type="ID"/>
       
    48     </attribute>
       
    49   </define>
       
    50   <!-- ~~~~~~ content -->
       
    51   <define name="document.content">
       
    52     <optional>
       
    53       <ref name="metadata"/>
       
    54     </optional>
       
    55     <choice>
       
    56       <oneOrMore>
       
    57         <ref name="division"/>
       
    58       </oneOrMore>
       
    59       <oneOrMore>
       
    60         <ref name="topic"/>
       
    61       </oneOrMore>
       
    62     </choice>
       
    63   </define>
       
    64   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
    65   <define name="top.topic">
       
    66     <element name="topic">
       
    67       <ref name="top.topic.attributes"/>
       
    68       <ref name="topic.content"/>
       
    69     </element>
       
    70   </define>
       
    71   <!--
       
    72     =============================================================================
       
    73                                   Metadata level
       
    74     =============================================================================
       
    75   -->
       
    76   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
    77   <define name="metadata">
       
    78     <element name="metadata">
       
    79       <ref name="metadata.content"/>
       
    80     </element>
       
    81   </define>
       
    82   <define name="metadata.content">
       
    83     <interleave>
       
    84       <ref name="title"/>
       
    85       <optional>
       
    86         <ref name="subtitle"/>
       
    87       </optional>
       
    88       <zeroOrMore>
       
    89         <ref name="author"/>
       
    90       </zeroOrMore>
       
    91       <optional>
       
    92         <ref name="publisher"/>
       
    93       </optional>
       
    94       <optional>
       
    95         <ref name="language"/>
       
    96       </optional>
       
    97       <optional>
       
    98         <ref name="date"/>
       
    99       </optional>
       
   100       <optional>
       
   101         <ref name="place"/>
       
   102       </optional>
       
   103       <zeroOrMore>
       
   104         <ref name="source"/>
       
   105       </zeroOrMore>
       
   106       <optional>
       
   107         <ref name="subjectset"/>
       
   108       </optional>
       
   109       <optional>
       
   110         <ref name="abstract"/>
       
   111       </optional>
       
   112       <zeroOrMore>
       
   113         <ref name="annotation"/>
       
   114       </zeroOrMore>
       
   115     </interleave>
       
   116   </define>
       
   117   <define name="language">
       
   118     <element name="language">
       
   119       <ref name="language.attributes"/>
       
   120     </element>
       
   121   </define>
       
   122   <define name="language.attributes">
       
   123     <ref name="lang.attribute"/>
       
   124   </define>
       
   125   <define name="lang.attribute">
       
   126     <attribute name="xml:lang">
       
   127       <data type="language"/>
       
   128     </attribute>
       
   129   </define>
       
   130   <define name="place">
       
   131     <element name="place">
       
   132       <ref name="place.content"/>
       
   133     </element>
       
   134   </define>
       
   135   <define name="place.content">
       
   136     <ref name="inlines"/>
       
   137   </define>
       
   138   <define name="abstract">
       
   139     <element name="abstract">
       
   140       <ref name="abstract.content"/>
       
   141     </element>
       
   142   </define>
       
   143   <define name="abstract.content">
       
   144     <oneOrMore>
       
   145       <ref name="parag"/>
       
   146     </oneOrMore>
       
   147   </define>
       
   148   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   149   <define name="title">
       
   150     <element name="title">
       
   151       <ref name="title.content"/>
       
   152     </element>
       
   153   </define>
       
   154   <define name="title.content">
       
   155     <ref name="inlines"/>
       
   156   </define>
       
   157   <define name="subtitle">
       
   158     <element name="subtitle">
       
   159       <ref name="title.content"/>
       
   160     </element>
       
   161   </define>
       
   162   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   163   <define name="author">
       
   164     <element name="author">
       
   165       <ref name="author.content"/>
       
   166     </element>
       
   167   </define>
       
   168   <define name="author.content">
       
   169     <optional>
       
   170       <ref name="firstname"/>
       
   171     </optional>
       
   172     <ref name="lastname"/>
       
   173   </define>
       
   174   <define name="publisher">
       
   175     <element name="publisher">
       
   176       <ref name="publisher.content"/>
       
   177     </element>
       
   178   </define>
       
   179   <define name="publisher.content">
       
   180     <ref name="inlines"/>
       
   181   </define>
       
   182   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   183   <define name="source">
       
   184     <element name="source">
       
   185       <ref name="source.attributes"/>
       
   186       <choice>
       
   187         <group>
       
   188           <attribute name="type">
       
   189             <value>book</value>
       
   190           </attribute>
       
   191           <ref name="source.content.book"/>
       
   192         </group>
       
   193         <attribute name="type">
       
   194           <value>file</value>
       
   195         </attribute>
       
   196       </choice>
       
   197       <ref name="source.content"/>
       
   198     </element>
       
   199   </define>
       
   200   <!-- ~~~~~~ Attributes -->
       
   201   <define name="source.attributes">
       
   202     <ref name="source.id.attribute"/>
       
   203   </define>
       
   204   <define name="source.id.attribute">
       
   205     <attribute name="id">
       
   206       <data type="NMTOKEN"/>
       
   207     </attribute>
       
   208   </define>
       
   209   <!-- ~~~~~~ Content -->
       
   210   <define name="source.content.book">
       
   211     <ref name="title"/>
       
   212     <zeroOrMore>
       
   213       <ref name="pagenumber"/>
       
   214     </zeroOrMore>
       
   215   </define>
       
   216   <define name="source.content">
       
   217     <zeroOrMore>
       
   218       <ref name="annotation"/>
       
   219     </zeroOrMore>
       
   220   </define>
       
   221   <define name="pagenumber">
       
   222     <element name="pagenumber">
       
   223       <ref name="pagenumber.attributes"/>
       
   224     </element>
       
   225   </define>
       
   226   <define name="pagenumber.attributes">
       
   227     <ref name="pagenumber.value.attribute"/>
       
   228   </define>
       
   229   <define name="pagenumber.value.attribute">
       
   230     <attribute name="value">
       
   231       <ref name="pagenumber.value.enumeration"/>
       
   232     </attribute>
       
   233   </define>
       
   234   <define name="pagenumber.value.enumeration">
       
   235     <data type="positiveInteger"/>
       
   236   </define>
       
   237   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   238   <define name="subjectset">
       
   239     <element name="subjectset">
       
   240       <ref name="subjectset.content"/>
       
   241     </element>
       
   242   </define>
       
   243   <define name="subjectset.content">
       
   244     <oneOrMore>
       
   245       <ref name="subject"/>
       
   246     </oneOrMore>
       
   247   </define>
       
   248   <define name="subject">
       
   249     <element name="subject">
       
   250       <ref name="subject.attributes"/>
       
   251     </element>
       
   252   </define>
       
   253   <define name="subject.attributes">
       
   254     <ref name="subject.id.attribute"/>
       
   255   </define>
       
   256   <define name="subject.id.attribute">
       
   257     <attribute name="id">
       
   258       <data type="NMTOKEN"/>
       
   259     </attribute>
       
   260   </define>
       
   261   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   262   <define name="annotation">
       
   263     <element name="annotation">
       
   264       <ref name="annotation.content"/>
       
   265     </element>
       
   266   </define>
       
   267   <define name="annotation.content">
       
   268     <ref name="inlines"/>
       
   269   </define>
       
   270   <!--
       
   271     =============================================================================
       
   272                                     Division level
       
   273     =============================================================================
       
   274   -->
       
   275   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ division ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   276   <define name="division">
       
   277     <element name="division">
       
   278       <ref name="division.content"/>
       
   279     </element>
       
   280   </define>
       
   281   <define name="division.content">
       
   282     <optional>
       
   283       <ref name="metadata"/>
       
   284     </optional>
       
   285     <choice>
       
   286       <oneOrMore>
       
   287         <ref name="division"/>
       
   288       </oneOrMore>
       
   289       <oneOrMore>
       
   290         <ref name="topic"/>
       
   291       </oneOrMore>
       
   292     </choice>
       
   293   </define>
       
   294   <!--
       
   295     =============================================================================
       
   296                                   Component level
       
   297     =============================================================================
       
   298   -->
       
   299   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   300   <define name="topic">
       
   301     <element name="topic">
       
   302       <ref name="topic.attributes"/>
       
   303       <ref name="topic.content"/>
       
   304     </element>
       
   305   </define>
       
   306   <!-- ~~~~~~ attributes -->
       
   307   <define name="top.topic.attributes">
       
   308     <interleave>
       
   309       <ref name="topic.id.attribute"/>
       
   310       <optional>
       
   311         <ref name="topic.type.attribute"/>
       
   312       </optional>
       
   313     </interleave>
       
   314   </define>
       
   315   <define name="topic.attributes">
       
   316     <interleave>
       
   317       <optional>
       
   318         <ref name="topic.id.attribute"/>
       
   319       </optional>
       
   320       <optional>
       
   321         <ref name="topic.type.attribute"/>
       
   322       </optional>
       
   323     </interleave>
       
   324   </define>
       
   325   <define name="topic.id.attribute">
       
   326     <attribute name="xml:id">
       
   327       <data type="ID"/>
       
   328     </attribute>
       
   329   </define>
       
   330   <define name="topic.type.attribute">
       
   331     <attribute name="type">
       
   332       <data type="NCName"/>
       
   333     </attribute>
       
   334   </define>
       
   335   <!-- ~~~~~~ content -->
       
   336   <define name="topic.content">
       
   337     <optional>
       
   338       <ref name="metadata"/>
       
   339     </optional>
       
   340     <oneOrMore>
       
   341       <ref name="section"/>
       
   342     </oneOrMore>
       
   343   </define>
       
   344   <!--
       
   345     =============================================================================
       
   346                                     Section level
       
   347     =============================================================================
       
   348   -->
       
   349   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   350   <define name="section">
       
   351     <element name="section">
       
   352       <ref name="section.content"/>
       
   353       <ref name="section.attributes"/>
       
   354     </element>
       
   355   </define>
       
   356   <define name="section.content">
       
   357     <optional>
       
   358       <ref name="metadata"/>
       
   359     </optional>
       
   360     <choice>
       
   361       <oneOrMore>
       
   362         <ref name="section"/>
       
   363       </oneOrMore>
       
   364       <oneOrMore>
       
   365         <choice>
       
   366           <ref name="parag"/>
       
   367           <ref name="media"/>
       
   368         </choice>
       
   369       </oneOrMore>
       
   370     </choice>
       
   371   </define>
       
   372   <define name="section.attributes">
       
   373     <optional>
       
   374       <ref name="status.attribute"/>
       
   375     </optional>
       
   376   </define>
       
   377   <define name="status.attribute">
       
   378     <attribute name="status">
       
   379       <data type="NCName"/>
       
   380     </attribute>
       
   381   </define>
       
   382   <!--
       
   383     =============================================================================
       
   384                                     Block level
       
   385     =============================================================================
       
   386   -->
       
   387   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parag ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   388   <define name="parag">
       
   389     <element name="parag">
       
   390       <ref name="parag.content"/>
       
   391     </element>
       
   392   </define>
       
   393   <define name="parag.content">
       
   394     <interleave>
       
   395       <ref name="inlines"/>
       
   396       <zeroOrMore>
       
   397         <ref name="link"/>
       
   398       </zeroOrMore>
       
   399     </interleave>
       
   400   </define>
       
   401   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   402   <define name="media">
       
   403     <element name="media">
       
   404       <ref name="media.content"/>
       
   405     </element>
       
   406   </define>
       
   407   <define name="media.content">
       
   408     <oneOrMore>
       
   409       <ref name="image"/>
       
   410     </oneOrMore>
       
   411     <optional>
       
   412       <ref name="media.caption"/>
       
   413     </optional>
       
   414   </define>
       
   415   <define name="media.id.attribute">
       
   416     <attribute name="id">
       
   417       <data type="NMTOKEN"/>
       
   418     </attribute>
       
   419   </define>
       
   420   <define name="media.caption">
       
   421     <element name="caption">
       
   422       <ref name="media.caption.content"/>
       
   423     </element>
       
   424   </define>
       
   425   <define name="media.caption.content">
       
   426     <oneOrMore>
       
   427       <ref name="parag"/>
       
   428     </oneOrMore>
       
   429   </define>
       
   430   <!-- ~~~~~~ Image -->
       
   431   <define name="image">
       
   432     <element name="image">
       
   433       <ref name="image.attributes"/>
       
   434       <ref name="image.content"/>
       
   435     </element>
       
   436   </define>
       
   437   <define name="image.attributes">
       
   438     <ref name="media.id.attribute"/>
       
   439   </define>
       
   440   <define name="image.content">
       
   441     <optional>
       
   442       <ref name="copyright"/>
       
   443     </optional>
       
   444   </define>
       
   445   <define name="copyright">
       
   446     <element name="copyright">
       
   447       <ref name="copyright.content"/>
       
   448     </element>
       
   449   </define>
       
   450   <define name="copyright.content">
       
   451     <ref name="inlines"/>
       
   452   </define>
       
   453   <!--
       
   454     =============================================================================
       
   455                                     Inline level
       
   456     =============================================================================
       
   457   -->
       
   458   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   459   <define name="inlines">
       
   460     <mixed>
       
   461       <interleave>
       
   462         <zeroOrMore>
       
   463           <ref name="sup"/>
       
   464         </zeroOrMore>
       
   465         <zeroOrMore>
       
   466           <ref name="sub"/>
       
   467         </zeroOrMore>
       
   468         <zeroOrMore>
       
   469           <ref name="romannum"/>
       
   470         </zeroOrMore>
       
   471         <zeroOrMore>
       
   472           <ref name="date"/>
       
   473         </zeroOrMore>
       
   474         <zeroOrMore>
       
   475           <ref name="name"/>
       
   476         </zeroOrMore>
       
   477         <zeroOrMore>
       
   478           <ref name="footnote"/>
       
   479         </zeroOrMore>
       
   480         <zeroOrMore>
       
   481           <ref name="foreign"/>
       
   482         </zeroOrMore>
       
   483         <zeroOrMore>
       
   484           <ref name="highlight"/>
       
   485         </zeroOrMore>
       
   486       </interleave>
       
   487     </mixed>
       
   488   </define>
       
   489   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   490   <define name="sup">
       
   491     <element name="sup">
       
   492       <ref name="inlines"/>
       
   493     </element>
       
   494   </define>
       
   495   <define name="sub">
       
   496     <element name="sub">
       
   497       <ref name="inlines"/>
       
   498     </element>
       
   499   </define>
       
   500   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ romannum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   501   <define name="romannum">
       
   502     <element name="romannum">
       
   503       <data type="token">
       
   504         <param name="pattern">([dlxvi]+)</param>
       
   505       </data>
       
   506     </element>
       
   507   </define>
       
   508   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   509   <define name="date">
       
   510     <element name="date">
       
   511       <ref name="date.attributes"/>
       
   512       <ref name="date.content"/>
       
   513     </element>
       
   514   </define>
       
   515   <define name="date.attributes">
       
   516     <ref name="date.of.attribute"/>
       
   517   </define>
       
   518   <define name="date.of.attribute">
       
   519     <attribute name="of">
       
   520       <ref name="date.of.enumeration"/>
       
   521     </attribute>
       
   522   </define>
       
   523   <define name="date.of.enumeration">
       
   524     <choice>
       
   525       <value>event</value>
       
   526       <value>birth</value>
       
   527       <value>death</value>
       
   528     </choice>
       
   529   </define>
       
   530   <define name="date.content">
       
   531     <choice>
       
   532       <data type="date"/>
       
   533       <data type="gYearMonth"/>
       
   534       <data type="gYear"/>
       
   535     </choice>
       
   536   </define>
       
   537   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   538   <define name="firstname">
       
   539     <element name="firstname">
       
   540       <ref name="inlines"/>
       
   541     </element>
       
   542   </define>
       
   543   <define name="lastname">
       
   544     <element name="lastname">
       
   545       <ref name="inlines"/>
       
   546     </element>
       
   547   </define>
       
   548   <define name="name">
       
   549     <element name="name">
       
   550       <ref name="name.attributes"/>
       
   551       <ref name="name.content"/>
       
   552     </element>
       
   553   </define>
       
   554   <define name="name.attributes">
       
   555     <optional>
       
   556       <ref name="name.of.attribute"/>
       
   557     </optional>
       
   558   </define>
       
   559   <define name="name.content">
       
   560     <ref name="inlines"/>
       
   561   </define>
       
   562   <define name="name.of.attribute">
       
   563     <attribute name="of">
       
   564       <ref name="name.of.enumeration"/>
       
   565     </attribute>
       
   566   </define>
       
   567   <define name="name.of.enumeration">
       
   568     <choice>
       
   569       <value>person</value>
       
   570       <value>company</value>
       
   571       <value>book</value>
       
   572       <value>newspaper</value>
       
   573       <value>party</value>
       
   574     </choice>
       
   575   </define>
       
   576   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footnote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   577   <define name="footnote">
       
   578     <element name="footnote">
       
   579       <ref name="footnote.attributes"/>
       
   580       <ref name="footnote.content"/>
       
   581     </element>
       
   582   </define>
       
   583   <define name="footnote.attributes">
       
   584     <optional>
       
   585       <ref name="footnote.label.attribute"/>
       
   586     </optional>
       
   587   </define>
       
   588   <define name="footnote.label.attribute">
       
   589     <attribute name="label"/>
       
   590   </define>
       
   591   <define name="footnote.content">
       
   592     <oneOrMore>
       
   593       <ref name="parag"/>
       
   594     </oneOrMore>
       
   595   </define>
       
   596   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   597   <define name="foreign">
       
   598     <element name="foreign">
       
   599       <ref name="foreign.attributes"/>
       
   600       <ref name="foreign.content"/>
       
   601     </element>
       
   602   </define>
       
   603   <define name="foreign.attributes">
       
   604     <optional>
       
   605       <ref name="lang.attribute"/>
       
   606     </optional>
       
   607   </define>
       
   608   <define name="foreign.content">
       
   609     <ref name="inlines"/>
       
   610   </define>
       
   611   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   612   <define name="highlight">
       
   613     <element name="highlight">
       
   614       <ref name="highlight.content"/>
       
   615     </element>
       
   616   </define>
       
   617   <define name="highlight.content">
       
   618     <ref name="inlines"/>
       
   619   </define>
       
   620   <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
       
   621   <define name="link">
       
   622     <element name="link">
       
   623       <ref name="link.attributes"/>
       
   624       <ref name="link.content"/>
       
   625     </element>
       
   626   </define>
       
   627   <define name="link.attributes">
       
   628     <empty/>
       
   629   </define>
       
   630   <define name="link.content">
       
   631     <ref name="inlines"/>
       
   632   </define>
       
   633 </grammar>