RelaxNG/publiset.rng
author Patrick PIERRE <patrick.pierre@prismallia.fr>
dim., 05 juin 2011 12:02:50 +0200
changeset 1 5f332cc7150a
parent 0 41a5385c69a2
child 2 417bb62f2a77
permissions -rw-r--r--
Ajout d'un logo
patrick@0
     1
<?xml version="1.0" encoding="UTF-8"?>
patrick@0
     2
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
patrick@0
     3
  <!-- $Id$ -->
patrick@0
     4
  <start>
patrick@0
     5
    <ref name="publiset"/>
patrick@0
     6
  </start>
patrick@0
     7
  <define name="publiset">
patrick@0
     8
    <element name="publiset">
patrick@0
     9
      <ref name="publiset.attributes"/>
patrick@0
    10
      <ref name="publiset.content"/>
patrick@0
    11
    </element>
patrick@0
    12
  </define>
patrick@0
    13
  <!-- ~~~~~~ attributes -->
patrick@0
    14
  <define name="publiset.attributes">
patrick@0
    15
    <ref name="version.attribute"/>
patrick@0
    16
  </define>
patrick@0
    17
  <define name="version.attribute">
patrick@0
    18
    <attribute name="version">
patrick@0
    19
      <value>1.0</value>
patrick@0
    20
    </attribute>
patrick@0
    21
  </define>
patrick@0
    22
  <!-- ~~~~~~ content -->
patrick@0
    23
  <define name="publiset.content">
patrick@0
    24
    <oneOrMore>
patrick@0
    25
      <choice>
patrick@0
    26
        <ref name="composition"/>
patrick@0
    27
        <ref name="selection"/>
patrick@0
    28
      </choice>
patrick@0
    29
    </oneOrMore>
patrick@0
    30
  </define>
patrick@0
    31
  <!--
patrick@0
    32
    =============================================================================
patrick@0
    33
                                     Top level
patrick@0
    34
    =============================================================================
patrick@0
    35
  -->
patrick@0
    36
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
    37
  <define name="composition">
patrick@0
    38
    <element name="composition">
patrick@0
    39
      <ref name="composition.attributes"/>
patrick@0
    40
      <ref name="composition.content"/>
patrick@0
    41
    </element>
patrick@0
    42
  </define>
patrick@0
    43
  <!-- ~~~~~~ attributes -->
patrick@0
    44
  <define name="composition.attributes">
patrick@0
    45
    <interleave>
patrick@0
    46
      <ref name="composition.id.attribute"/>
patrick@0
    47
      <optional>
patrick@0
    48
        <ref name="base.attribute"/>
patrick@0
    49
      </optional>
patrick@0
    50
      <ref name="remap.attributes"/>
patrick@0
    51
    </interleave>
patrick@0
    52
  </define>
patrick@0
    53
  <define name="composition.id.attribute">
patrick@0
    54
    <attribute name="xml:id">
patrick@0
    55
      <data type="ID"/>
patrick@0
    56
    </attribute>
patrick@0
    57
  </define>
patrick@0
    58
  <define name="base.attribute">
patrick@0
    59
    <attribute name="xml:base">
patrick@0
    60
      <data type="anyURI"/>
patrick@0
    61
    </attribute>
patrick@0
    62
  </define>
patrick@0
    63
  <!-- ~~~~~~ content -->
patrick@0
    64
  <define name="composition.content">
patrick@0
    65
    <optional>
patrick@0
    66
      <ref name="composition.metadata"/>
patrick@0
    67
    </optional>
patrick@0
    68
    <oneOrMore>
patrick@0
    69
      <choice>
patrick@0
    70
        <ref name="composition.file"/>
patrick@0
    71
        <ref name="composition.division"/>
patrick@0
    72
      </choice>
patrick@0
    73
    </oneOrMore>
patrick@0
    74
  </define>
patrick@0
    75
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
    76
  <define name="selection">
patrick@0
    77
    <element name="selection">
patrick@0
    78
      <ref name="selection.attributes"/>
patrick@0
    79
      <ref name="selection.content"/>
patrick@0
    80
    </element>
patrick@0
    81
  </define>
patrick@0
    82
  <!-- ~~~~~~ attributes -->
patrick@0
    83
  <define name="selection.attributes">
patrick@0
    84
    <optional>
patrick@0
    85
      <ref name="base.attribute"/>
patrick@0
    86
    </optional>
patrick@0
    87
  </define>
patrick@0
    88
  <define name="selection.id.attribute">
patrick@0
    89
    <attribute name="xml:id">
patrick@0
    90
      <data type="ID"/>
patrick@0
    91
    </attribute>
patrick@0
    92
  </define>
patrick@0
    93
  <!-- ~~~~~~ content -->
patrick@0
    94
  <define name="selection.content">
patrick@0
    95
    <optional>
patrick@0
    96
      <ref name="selection.metadata"/>
patrick@0
    97
    </optional>
patrick@0
    98
    <oneOrMore>
patrick@0
    99
      <choice>
patrick@0
   100
        <ref name="selection.file"/>
patrick@0
   101
        <ref name="selection.division"/>
patrick@0
   102
      </choice>
patrick@0
   103
    </oneOrMore>
patrick@0
   104
  </define>
patrick@0
   105
  <!--
patrick@0
   106
    =============================================================================
patrick@0
   107
                                    Metadata level
patrick@0
   108
    =============================================================================
patrick@0
   109
  -->
patrick@0
   110
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   111
  <define name="composition.metadata">
patrick@0
   112
    <element name="metadata">
patrick@0
   113
      <ref name="metadata.attributes"/>
patrick@0
   114
      <ref name="metadata.content"/>
patrick@0
   115
    </element>
patrick@0
   116
  </define>
patrick@0
   117
  <define name="selection.metadata">
patrick@0
   118
    <element name="metadata">
patrick@0
   119
      <ref name="metadata.content"/>
patrick@0
   120
    </element>
patrick@0
   121
  </define>
patrick@0
   122
  <!-- ~~~~~~ attributes -->
patrick@0
   123
  <define name="metadata.attributes">
patrick@0
   124
    <ref name="remap.attributes"/>
patrick@0
   125
  </define>
patrick@0
   126
  <!-- ~~~~~~ content -->
patrick@0
   127
  <define name="metadata.content">
patrick@0
   128
    <optional>
patrick@0
   129
      <ref name="title"/>
patrick@0
   130
    </optional>
patrick@0
   131
    <optional>
patrick@0
   132
      <ref name="subtitle"/>
patrick@0
   133
    </optional>
patrick@0
   134
    <optional>
patrick@0
   135
      <ref name="source"/>
patrick@0
   136
    </optional>
patrick@0
   137
  </define>
patrick@0
   138
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   139
  <define name="title">
patrick@0
   140
    <element name="title">
patrick@0
   141
      <ref name="title.content"/>
patrick@0
   142
    </element>
patrick@0
   143
  </define>
patrick@0
   144
  <define name="title.content">
patrick@0
   145
    <ref name="inlines"/>
patrick@0
   146
  </define>
patrick@0
   147
  <define name="subtitle">
patrick@0
   148
    <element name="subtitle">
patrick@0
   149
      <ref name="title.content"/>
patrick@0
   150
    </element>
patrick@0
   151
  </define>
patrick@0
   152
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   153
  <define name="source">
patrick@0
   154
    <element name="source">
patrick@0
   155
      <ref name="source.attributes"/>
patrick@0
   156
      <choice>
patrick@0
   157
        <group>
patrick@0
   158
          <attribute name="type">
patrick@0
   159
            <value>book</value>
patrick@0
   160
          </attribute>
patrick@0
   161
          <ref name="source.content.book"/>
patrick@0
   162
        </group>
patrick@0
   163
        <attribute name="type">
patrick@0
   164
          <value>file</value>
patrick@0
   165
        </attribute>
patrick@0
   166
      </choice>
patrick@0
   167
    </element>
patrick@0
   168
  </define>
patrick@0
   169
  <!-- ~~~~~~ Attributes -->
patrick@0
   170
  <define name="source.attributes">
patrick@0
   171
    <interleave>
patrick@0
   172
      <optional>
patrick@0
   173
        <ref name="source.id.attribute"/>
patrick@0
   174
      </optional>
patrick@0
   175
      <ref name="remap.attributes"/>
patrick@0
   176
    </interleave>
patrick@0
   177
  </define>
patrick@0
   178
  <define name="source.id.attribute">
patrick@0
   179
    <attribute name="id">
patrick@0
   180
      <data type="NMTOKEN"/>
patrick@0
   181
    </attribute>
patrick@0
   182
  </define>
patrick@0
   183
  <!-- ~~~~~~ Content -->
patrick@0
   184
  <define name="source.content.book">
patrick@0
   185
    <optional>
patrick@0
   186
      <ref name="title"/>
patrick@0
   187
    </optional>
patrick@0
   188
    <optional>
patrick@0
   189
      <ref name="pagenumber"/>
patrick@0
   190
    </optional>
patrick@0
   191
  </define>
patrick@0
   192
  <define name="pagenumber">
patrick@0
   193
    <element name="pagenumber">
patrick@0
   194
      <ref name="pagenumber.attributes"/>
patrick@0
   195
    </element>
patrick@0
   196
  </define>
patrick@0
   197
  <define name="pagenumber.attributes">
patrick@0
   198
    <ref name="pagenumber.value.attribute"/>
patrick@0
   199
  </define>
patrick@0
   200
  <define name="pagenumber.value.attribute">
patrick@0
   201
    <attribute name="value">
patrick@0
   202
      <ref name="pagenumber.value.enumeration"/>
patrick@0
   203
    </attribute>
patrick@0
   204
  </define>
patrick@0
   205
  <define name="pagenumber.value.enumeration">
patrick@0
   206
    <data type="positiveInteger"/>
patrick@0
   207
  </define>
patrick@0
   208
  <!--
patrick@0
   209
    =============================================================================
patrick@0
   210
                                   Division level
patrick@0
   211
    =============================================================================
patrick@0
   212
  -->
patrick@0
   213
  <define name="composition.division">
patrick@0
   214
    <element name="division">
patrick@0
   215
      <ref name="composition.division.attributes"/>
patrick@0
   216
      <ref name="composition.division.content"/>
patrick@0
   217
    </element>
patrick@0
   218
  </define>
patrick@0
   219
  <define name="selection.division">
patrick@0
   220
    <element name="division">
patrick@0
   221
      <ref name="selection.division.attributes"/>
patrick@0
   222
      <ref name="selection.division.content"/>
patrick@0
   223
    </element>
patrick@0
   224
  </define>
patrick@0
   225
  <!-- ~~~~~~ attributes -->
patrick@0
   226
  <define name="composition.division.attributes">
patrick@0
   227
    <interleave>
patrick@0
   228
      <optional>
patrick@0
   229
        <ref name="base.attribute"/>
patrick@0
   230
      </optional>
patrick@0
   231
      <ref name="remap.attributes"/>
patrick@0
   232
    </interleave>
patrick@0
   233
  </define>
patrick@0
   234
  <define name="selection.division.attributes">
patrick@0
   235
    <optional>
patrick@0
   236
      <ref name="base.attribute"/>
patrick@0
   237
    </optional>
patrick@0
   238
  </define>
patrick@0
   239
  <!-- ~~~~~~ content -->
patrick@0
   240
  <define name="composition.division.content">
patrick@0
   241
    <optional>
patrick@0
   242
      <ref name="composition.metadata"/>
patrick@0
   243
    </optional>
patrick@0
   244
    <oneOrMore>
patrick@0
   245
      <choice>
patrick@0
   246
        <ref name="composition.file"/>
patrick@0
   247
        <ref name="composition.division"/>
patrick@0
   248
      </choice>
patrick@0
   249
    </oneOrMore>
patrick@0
   250
  </define>
patrick@0
   251
  <define name="selection.division.content">
patrick@0
   252
    <optional>
patrick@0
   253
      <ref name="selection.metadata"/>
patrick@0
   254
    </optional>
patrick@0
   255
    <oneOrMore>
patrick@0
   256
      <choice>
patrick@0
   257
        <ref name="selection.file"/>
patrick@0
   258
        <ref name="selection.division"/>
patrick@0
   259
      </choice>
patrick@0
   260
    </oneOrMore>
patrick@0
   261
  </define>
patrick@0
   262
  <!--
patrick@0
   263
    =============================================================================
patrick@0
   264
                                     File level
patrick@0
   265
    =============================================================================
patrick@0
   266
  -->
patrick@0
   267
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   268
  <define name="composition.file">
patrick@0
   269
    <element name="file">
patrick@0
   270
      <ref name="composition.file.attributes"/>
patrick@0
   271
    </element>
patrick@0
   272
  </define>
patrick@0
   273
  <define name="selection.file">
patrick@0
   274
    <element name="file">
patrick@0
   275
      <ref name="selection.file.attributes"/>
patrick@0
   276
    </element>
patrick@0
   277
  </define>
patrick@0
   278
  <!-- ~~~~~~ attributes -->
patrick@0
   279
  <define name="composition.file.attributes">
patrick@0
   280
    <interleave>
patrick@0
   281
      <ref name="name.attribute"/>
patrick@0
   282
      <optional>
patrick@0
   283
        <ref name="xpath.attribute"/>
patrick@0
   284
      </optional>
patrick@0
   285
      <ref name="remap.attributes"/>
patrick@0
   286
    </interleave>
patrick@0
   287
  </define>
patrick@0
   288
  <define name="selection.file.attributes">
patrick@0
   289
    <interleave>
patrick@0
   290
      <ref name="name.attribute"/>
patrick@0
   291
      <optional>
patrick@0
   292
        <ref name="xpath.attribute"/>
patrick@0
   293
      </optional>
patrick@0
   294
    </interleave>
patrick@0
   295
  </define>
patrick@0
   296
  <define name="name.attribute">
patrick@0
   297
    <attribute name="name"/>
patrick@0
   298
  </define>
patrick@0
   299
  <define name="xpath.attribute">
patrick@0
   300
    <attribute name="xpath"/>
patrick@0
   301
  </define>
patrick@0
   302
  <!--
patrick@0
   303
    =============================================================================
patrick@0
   304
                                    Inline level
patrick@0
   305
    =============================================================================
patrick@0
   306
  -->
patrick@0
   307
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   308
  <define name="inlines">
patrick@0
   309
    <mixed>
patrick@0
   310
      <interleave>
patrick@0
   311
        <zeroOrMore>
patrick@0
   312
          <ref name="sup"/>
patrick@0
   313
        </zeroOrMore>
patrick@0
   314
        <zeroOrMore>
patrick@0
   315
          <ref name="sub"/>
patrick@0
   316
        </zeroOrMore>
patrick@0
   317
      </interleave>
patrick@0
   318
    </mixed>
patrick@0
   319
  </define>
patrick@0
   320
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   321
  <define name="sup">
patrick@0
   322
    <element name="sup">
patrick@0
   323
      <ref name="inlines"/>
patrick@0
   324
    </element>
patrick@0
   325
  </define>
patrick@0
   326
  <define name="sub">
patrick@0
   327
    <element name="sub">
patrick@0
   328
      <ref name="inlines"/>
patrick@0
   329
    </element>
patrick@0
   330
  </define>
patrick@0
   331
  <!--
patrick@0
   332
    =============================================================================
patrick@0
   333
                                  Remap attributes
patrick@0
   334
    =============================================================================
patrick@0
   335
  -->
patrick@0
   336
  <define name="remap.attributes">
patrick@0
   337
    <interleave>
patrick@0
   338
      <optional>
patrick@0
   339
        <ref name="as.attribute"/>
patrick@0
   340
      </optional>
patrick@0
   341
      <optional>
patrick@0
   342
        <ref name="attributes.attribute"/>
patrick@0
   343
      </optional>
patrick@0
   344
    </interleave>
patrick@0
   345
  </define>
patrick@0
   346
  <define name="as.attribute">
patrick@0
   347
    <attribute name="as">
patrick@0
   348
      <data type="QName"/>
patrick@0
   349
    </attribute>
patrick@0
   350
  </define>
patrick@0
   351
  <define name="attributes.attribute">
patrick@0
   352
    <attribute name="attributes">
patrick@0
   353
      <list>
patrick@0
   354
        <oneOrMore>
patrick@0
   355
          <data type="token">
patrick@0
   356
            <param name="pattern">\c+=\S+</param>
patrick@0
   357
          </data>
patrick@0
   358
        </oneOrMore>
patrick@0
   359
      </list>
patrick@0
   360
    </attribute>
patrick@0
   361
  </define>
patrick@0
   362
</grammar>