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