RelaxNG/publiset.rng
author Patrick PIERRE <patrick.pierre@prismallia.fr>
ven., 10 juin 2011 16:35:10 +0200
changeset 8 1d4ee28efd68
parent 5 69310bc35b63
child 20 79713ffae179
permissions -rw-r--r--
Mise en forme
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@5
   120
    <interleave>
patrick@5
   121
      <optional>
patrick@5
   122
        <ref name="title"/>
patrick@5
   123
      </optional>
patrick@5
   124
      <optional>
patrick@5
   125
        <ref name="subtitle"/>
patrick@5
   126
      </optional>
patrick@5
   127
      <zeroOrMore>
patrick@5
   128
        <ref name="author"/>
patrick@5
   129
      </zeroOrMore>
patrick@5
   130
      <optional>
patrick@5
   131
        <ref name="publisher"/>
patrick@5
   132
      </optional>
patrick@5
   133
      <optional>
patrick@5
   134
        <ref name="language"/>
patrick@5
   135
      </optional>
patrick@5
   136
      <optional>
patrick@5
   137
        <ref name="source"/>
patrick@5
   138
      </optional>
patrick@5
   139
    </interleave>
patrick@0
   140
  </define>
patrick@0
   141
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   142
  <define name="title">
patrick@0
   143
    <element name="title">
patrick@0
   144
      <ref name="title.content"/>
patrick@0
   145
    </element>
patrick@0
   146
  </define>
patrick@0
   147
  <define name="title.content">
patrick@0
   148
    <ref name="inlines"/>
patrick@0
   149
  </define>
patrick@0
   150
  <define name="subtitle">
patrick@0
   151
    <element name="subtitle">
patrick@0
   152
      <ref name="title.content"/>
patrick@0
   153
    </element>
patrick@0
   154
  </define>
patrick@5
   155
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@5
   156
  <!-- ~~~~~~ author -->
patrick@5
   157
  <define name="author">
patrick@5
   158
    <element name="author">
patrick@5
   159
      <ref name="author.content"/>
patrick@5
   160
    </element>
patrick@5
   161
  </define>
patrick@5
   162
  <define name="author.content">
patrick@5
   163
    <optional>
patrick@5
   164
      <ref name="firstname"/>
patrick@5
   165
    </optional>
patrick@5
   166
    <ref name="lastname"/>
patrick@5
   167
  </define>
patrick@5
   168
  <!-- ~~~~~~ publisher -->
patrick@5
   169
  <define name="publisher">
patrick@5
   170
    <element name="publisher">
patrick@5
   171
      <ref name="publisher.content"/>
patrick@5
   172
    </element>
patrick@5
   173
  </define>
patrick@5
   174
  <define name="publisher.content">
patrick@5
   175
    <ref name="inlines"/>
patrick@5
   176
  </define>
patrick@5
   177
  <!-- ~~~~~~ firstname -->
patrick@5
   178
  <define name="firstname">
patrick@5
   179
    <element name="firstname">
patrick@5
   180
      <ref name="firstname.content"/>
patrick@5
   181
    </element>
patrick@5
   182
  </define>
patrick@5
   183
  <define name="firstname.content">
patrick@5
   184
    <ref name="inlines"/>
patrick@5
   185
  </define>
patrick@5
   186
  <!-- ~~~~~~ lastname -->
patrick@5
   187
  <define name="lastname">
patrick@5
   188
    <element name="lastname">
patrick@5
   189
      <ref name="lastname.content"/>
patrick@5
   190
    </element>
patrick@5
   191
  </define>
patrick@5
   192
  <define name="lastname.content">
patrick@5
   193
    <ref name="inlines"/>
patrick@5
   194
  </define>
patrick@5
   195
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@5
   196
  <define name="language">
patrick@5
   197
    <element name="language">
patrick@5
   198
      <ref name="language.attributes"/>
patrick@5
   199
    </element>
patrick@5
   200
  </define>
patrick@5
   201
  <define name="language.attributes">
patrick@5
   202
    <ref name="lang.attribute"/>
patrick@5
   203
  </define>
patrick@5
   204
  <define name="lang.attribute">
patrick@5
   205
    <attribute name="xml:lang">
patrick@5
   206
      <data type="language"/>
patrick@5
   207
    </attribute>
patrick@5
   208
  </define>
patrick@0
   209
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@2
   210
  <!-- ~~~~~~ source -->
patrick@0
   211
  <define name="source">
patrick@0
   212
    <element name="source">
patrick@0
   213
      <ref name="source.attributes"/>
patrick@0
   214
      <choice>
patrick@0
   215
        <group>
patrick@0
   216
          <attribute name="type">
patrick@0
   217
            <value>book</value>
patrick@0
   218
          </attribute>
patrick@0
   219
          <ref name="source.content.book"/>
patrick@0
   220
        </group>
patrick@0
   221
        <attribute name="type">
patrick@0
   222
          <value>file</value>
patrick@0
   223
        </attribute>
patrick@0
   224
      </choice>
patrick@0
   225
    </element>
patrick@0
   226
  </define>
patrick@0
   227
  <define name="source.attributes">
patrick@0
   228
    <interleave>
patrick@0
   229
      <optional>
patrick@0
   230
        <ref name="source.id.attribute"/>
patrick@0
   231
      </optional>
patrick@0
   232
      <ref name="remap.attributes"/>
patrick@0
   233
    </interleave>
patrick@0
   234
  </define>
patrick@0
   235
  <define name="source.id.attribute">
patrick@0
   236
    <attribute name="id">
patrick@0
   237
      <data type="NMTOKEN"/>
patrick@0
   238
    </attribute>
patrick@0
   239
  </define>
patrick@0
   240
  <define name="source.content.book">
patrick@0
   241
    <optional>
patrick@0
   242
      <ref name="title"/>
patrick@0
   243
    </optional>
patrick@0
   244
    <optional>
patrick@0
   245
      <ref name="pagenumber"/>
patrick@0
   246
    </optional>
patrick@0
   247
  </define>
patrick@2
   248
  <!-- ~~~~~~ pagenumber -->
patrick@0
   249
  <define name="pagenumber">
patrick@0
   250
    <element name="pagenumber">
patrick@0
   251
      <ref name="pagenumber.attributes"/>
patrick@0
   252
    </element>
patrick@0
   253
  </define>
patrick@0
   254
  <define name="pagenumber.attributes">
patrick@0
   255
    <ref name="pagenumber.value.attribute"/>
patrick@0
   256
  </define>
patrick@0
   257
  <define name="pagenumber.value.attribute">
patrick@0
   258
    <attribute name="value">
patrick@0
   259
      <ref name="pagenumber.value.enumeration"/>
patrick@0
   260
    </attribute>
patrick@0
   261
  </define>
patrick@0
   262
  <define name="pagenumber.value.enumeration">
patrick@0
   263
    <data type="positiveInteger"/>
patrick@0
   264
  </define>
patrick@0
   265
  <!--
patrick@0
   266
    =============================================================================
patrick@0
   267
                                   Division level
patrick@0
   268
    =============================================================================
patrick@0
   269
  -->
patrick@0
   270
  <define name="composition.division">
patrick@0
   271
    <element name="division">
patrick@0
   272
      <ref name="composition.division.attributes"/>
patrick@0
   273
      <ref name="composition.division.content"/>
patrick@0
   274
    </element>
patrick@0
   275
  </define>
patrick@0
   276
  <define name="selection.division">
patrick@0
   277
    <element name="division">
patrick@0
   278
      <ref name="selection.division.attributes"/>
patrick@0
   279
      <ref name="selection.division.content"/>
patrick@0
   280
    </element>
patrick@0
   281
  </define>
patrick@0
   282
  <define name="composition.division.attributes">
patrick@0
   283
    <interleave>
patrick@0
   284
      <optional>
patrick@0
   285
        <ref name="base.attribute"/>
patrick@0
   286
      </optional>
patrick@0
   287
      <ref name="remap.attributes"/>
patrick@0
   288
    </interleave>
patrick@0
   289
  </define>
patrick@0
   290
  <define name="selection.division.attributes">
patrick@0
   291
    <optional>
patrick@0
   292
      <ref name="base.attribute"/>
patrick@0
   293
    </optional>
patrick@0
   294
  </define>
patrick@0
   295
  <define name="composition.division.content">
patrick@0
   296
    <optional>
patrick@0
   297
      <ref name="composition.metadata"/>
patrick@0
   298
    </optional>
patrick@0
   299
    <oneOrMore>
patrick@0
   300
      <choice>
patrick@0
   301
        <ref name="composition.file"/>
patrick@0
   302
        <ref name="composition.division"/>
patrick@0
   303
      </choice>
patrick@0
   304
    </oneOrMore>
patrick@0
   305
  </define>
patrick@0
   306
  <define name="selection.division.content">
patrick@0
   307
    <optional>
patrick@0
   308
      <ref name="selection.metadata"/>
patrick@0
   309
    </optional>
patrick@0
   310
    <oneOrMore>
patrick@0
   311
      <choice>
patrick@0
   312
        <ref name="selection.file"/>
patrick@0
   313
        <ref name="selection.division"/>
patrick@0
   314
      </choice>
patrick@0
   315
    </oneOrMore>
patrick@0
   316
  </define>
patrick@0
   317
  <!--
patrick@0
   318
    =============================================================================
patrick@0
   319
                                     File level
patrick@0
   320
    =============================================================================
patrick@0
   321
  -->
patrick@0
   322
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   323
  <define name="composition.file">
patrick@0
   324
    <element name="file">
patrick@0
   325
      <ref name="composition.file.attributes"/>
patrick@2
   326
      <ref name="file.content"/>
patrick@0
   327
    </element>
patrick@0
   328
  </define>
patrick@0
   329
  <define name="selection.file">
patrick@0
   330
    <element name="file">
patrick@0
   331
      <ref name="selection.file.attributes"/>
patrick@2
   332
      <ref name="file.content"/>
patrick@0
   333
    </element>
patrick@0
   334
  </define>
patrick@0
   335
  <define name="composition.file.attributes">
patrick@0
   336
    <interleave>
patrick@0
   337
      <optional>
patrick@0
   338
        <ref name="xpath.attribute"/>
patrick@0
   339
      </optional>
patrick@0
   340
      <ref name="remap.attributes"/>
patrick@0
   341
    </interleave>
patrick@0
   342
  </define>
patrick@0
   343
  <define name="selection.file.attributes">
patrick@2
   344
    <optional>
patrick@2
   345
      <ref name="xpath.attribute"/>
patrick@2
   346
    </optional>
patrick@0
   347
  </define>
patrick@0
   348
  <define name="xpath.attribute">
patrick@0
   349
    <attribute name="xpath"/>
patrick@0
   350
  </define>
patrick@2
   351
  <define name="file.content">
patrick@2
   352
    <data type="anyURI"/>
patrick@2
   353
  </define>
patrick@0
   354
  <!--
patrick@0
   355
    =============================================================================
patrick@0
   356
                                    Inline level
patrick@0
   357
    =============================================================================
patrick@0
   358
  -->
patrick@0
   359
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   360
  <define name="inlines">
patrick@0
   361
    <mixed>
patrick@0
   362
      <interleave>
patrick@0
   363
        <zeroOrMore>
patrick@0
   364
          <ref name="sup"/>
patrick@0
   365
        </zeroOrMore>
patrick@0
   366
        <zeroOrMore>
patrick@0
   367
          <ref name="sub"/>
patrick@0
   368
        </zeroOrMore>
patrick@0
   369
      </interleave>
patrick@0
   370
    </mixed>
patrick@0
   371
  </define>
patrick@0
   372
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   373
  <define name="sup">
patrick@0
   374
    <element name="sup">
patrick@0
   375
      <ref name="inlines"/>
patrick@0
   376
    </element>
patrick@0
   377
  </define>
patrick@0
   378
  <define name="sub">
patrick@0
   379
    <element name="sub">
patrick@0
   380
      <ref name="inlines"/>
patrick@0
   381
    </element>
patrick@0
   382
  </define>
patrick@0
   383
  <!--
patrick@0
   384
    =============================================================================
patrick@0
   385
                                  Remap attributes
patrick@0
   386
    =============================================================================
patrick@0
   387
  -->
patrick@0
   388
  <define name="remap.attributes">
patrick@0
   389
    <interleave>
patrick@0
   390
      <optional>
patrick@0
   391
        <ref name="as.attribute"/>
patrick@0
   392
      </optional>
patrick@0
   393
      <optional>
patrick@0
   394
        <ref name="attributes.attribute"/>
patrick@0
   395
      </optional>
patrick@0
   396
    </interleave>
patrick@0
   397
  </define>
patrick@0
   398
  <define name="as.attribute">
patrick@0
   399
    <attribute name="as">
patrick@0
   400
      <data type="QName"/>
patrick@0
   401
    </attribute>
patrick@0
   402
  </define>
patrick@0
   403
  <define name="attributes.attribute">
patrick@0
   404
    <attribute name="attributes">
patrick@0
   405
      <list>
patrick@0
   406
        <oneOrMore>
patrick@0
   407
          <data type="token">
patrick@0
   408
            <param name="pattern">\c+=\S+</param>
patrick@0
   409
          </data>
patrick@0
   410
        </oneOrMore>
patrick@0
   411
      </list>
patrick@0
   412
    </attribute>
patrick@0
   413
  </define>
patrick@0
   414
</grammar>