RelaxNG/publiset.rng
author Patrick PIERRE <patrick.pierre@prismallia.fr>
dim., 12 juin 2011 16:02:23 +0200
changeset 21 7c09024d5634
parent 20 79713ffae179
child 23 814ea44c2469
permissions -rw-r--r--
Correction coquilles
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@20
    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@20
    62
      <ref name="composition.head"/>
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@20
    90
      <ref name="selection.head"/>
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@20
   101
                                     HEAD LEVEL
patrick@0
   102
    =============================================================================
patrick@0
   103
  -->
patrick@20
   104
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@20
   105
  <define name="composition.head">
patrick@20
   106
    <element name="head">
patrick@20
   107
      <ref name="head.attributes"/>
patrick@20
   108
      <ref name="top.head.content"/>
patrick@0
   109
    </element>
patrick@0
   110
  </define>
patrick@20
   111
  <define name="selection.head">
patrick@20
   112
    <element name="head">
patrick@20
   113
      <ref name="top.head.content"/>
patrick@0
   114
    </element>
patrick@0
   115
  </define>
patrick@20
   116
  <define name="division.head">
patrick@20
   117
    <element name="head">
patrick@20
   118
      <ref name="division.head.content"/>
patrick@20
   119
    </element>
patrick@20
   120
  </define>
patrick@20
   121
  <define name="head.attributes">
patrick@0
   122
    <ref name="remap.attributes"/>
patrick@0
   123
  </define>
patrick@20
   124
  <define name="top.head.content">
patrick@5
   125
    <interleave>
patrick@5
   126
      <optional>
patrick@5
   127
        <ref name="title"/>
patrick@20
   128
        <optional>
patrick@20
   129
          <ref name="subtitle"/>
patrick@20
   130
        </optional>
patrick@5
   131
      </optional>
patrick@5
   132
      <optional>
patrick@20
   133
        <ref name="language"/>
patrick@5
   134
      </optional>
patrick@5
   135
      <zeroOrMore>
patrick@5
   136
        <ref name="author"/>
patrick@5
   137
      </zeroOrMore>
patrick@5
   138
      <optional>
patrick@5
   139
        <ref name="publisher"/>
patrick@5
   140
      </optional>
patrick@5
   141
      <optional>
patrick@20
   142
        <ref name="source"/>
patrick@20
   143
      </optional>
patrick@20
   144
    </interleave>
patrick@20
   145
  </define>
patrick@20
   146
  <define name="division.head.content">
patrick@20
   147
    <interleave>
patrick@20
   148
      <optional>
patrick@20
   149
        <ref name="title"/>
patrick@20
   150
        <optional>
patrick@20
   151
          <ref name="subtitle"/>
patrick@20
   152
        </optional>
patrick@20
   153
      </optional>
patrick@20
   154
      <optional>
patrick@5
   155
        <ref name="language"/>
patrick@5
   156
      </optional>
patrick@5
   157
    </interleave>
patrick@0
   158
  </define>
patrick@0
   159
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   160
  <define name="title">
patrick@0
   161
    <element name="title">
patrick@0
   162
      <ref name="title.content"/>
patrick@0
   163
    </element>
patrick@0
   164
  </define>
patrick@0
   165
  <define name="subtitle">
patrick@0
   166
    <element name="subtitle">
patrick@0
   167
      <ref name="title.content"/>
patrick@0
   168
    </element>
patrick@0
   169
  </define>
patrick@20
   170
  <define name="title.content">
patrick@20
   171
    <ref name="inlines"/>
patrick@20
   172
  </define>
patrick@20
   173
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@20
   174
  <define name="language">
patrick@20
   175
    <element name="language">
patrick@20
   176
      <ref name="language.attributes"/>
patrick@20
   177
    </element>
patrick@20
   178
  </define>
patrick@20
   179
  <define name="language.attributes">
patrick@20
   180
    <ref name="lang.attribute"/>
patrick@20
   181
  </define>
patrick@20
   182
  <define name="lang.attribute">
patrick@20
   183
    <attribute name="xml:lang">
patrick@20
   184
      <data type="language"/>
patrick@20
   185
    </attribute>
patrick@20
   186
  </define>
patrick@5
   187
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@5
   188
  <!-- ~~~~~~ author -->
patrick@5
   189
  <define name="author">
patrick@5
   190
    <element name="author">
patrick@5
   191
      <ref name="author.content"/>
patrick@5
   192
    </element>
patrick@5
   193
  </define>
patrick@5
   194
  <define name="author.content">
patrick@5
   195
    <optional>
patrick@5
   196
      <ref name="firstname"/>
patrick@5
   197
    </optional>
patrick@5
   198
    <ref name="lastname"/>
patrick@5
   199
  </define>
patrick@5
   200
  <!-- ~~~~~~ publisher -->
patrick@5
   201
  <define name="publisher">
patrick@5
   202
    <element name="publisher">
patrick@5
   203
      <ref name="publisher.content"/>
patrick@5
   204
    </element>
patrick@5
   205
  </define>
patrick@5
   206
  <define name="publisher.content">
patrick@5
   207
    <ref name="inlines"/>
patrick@5
   208
  </define>
patrick@5
   209
  <!-- ~~~~~~ firstname -->
patrick@5
   210
  <define name="firstname">
patrick@5
   211
    <element name="firstname">
patrick@5
   212
      <ref name="firstname.content"/>
patrick@5
   213
    </element>
patrick@5
   214
  </define>
patrick@5
   215
  <define name="firstname.content">
patrick@5
   216
    <ref name="inlines"/>
patrick@5
   217
  </define>
patrick@5
   218
  <!-- ~~~~~~ lastname -->
patrick@5
   219
  <define name="lastname">
patrick@5
   220
    <element name="lastname">
patrick@5
   221
      <ref name="lastname.content"/>
patrick@5
   222
    </element>
patrick@5
   223
  </define>
patrick@5
   224
  <define name="lastname.content">
patrick@5
   225
    <ref name="inlines"/>
patrick@5
   226
  </define>
patrick@0
   227
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@2
   228
  <!-- ~~~~~~ source -->
patrick@0
   229
  <define name="source">
patrick@0
   230
    <element name="source">
patrick@0
   231
      <ref name="source.attributes"/>
patrick@0
   232
      <choice>
patrick@0
   233
        <group>
patrick@0
   234
          <attribute name="type">
patrick@0
   235
            <value>book</value>
patrick@0
   236
          </attribute>
patrick@0
   237
          <ref name="source.content.book"/>
patrick@0
   238
        </group>
patrick@0
   239
        <attribute name="type">
patrick@0
   240
          <value>file</value>
patrick@0
   241
        </attribute>
patrick@0
   242
      </choice>
patrick@0
   243
    </element>
patrick@0
   244
  </define>
patrick@0
   245
  <define name="source.attributes">
patrick@0
   246
    <interleave>
patrick@0
   247
      <optional>
patrick@0
   248
        <ref name="source.id.attribute"/>
patrick@0
   249
      </optional>
patrick@0
   250
      <ref name="remap.attributes"/>
patrick@0
   251
    </interleave>
patrick@0
   252
  </define>
patrick@0
   253
  <define name="source.id.attribute">
patrick@0
   254
    <attribute name="id">
patrick@0
   255
      <data type="NMTOKEN"/>
patrick@0
   256
    </attribute>
patrick@0
   257
  </define>
patrick@0
   258
  <define name="source.content.book">
patrick@0
   259
    <optional>
patrick@0
   260
      <ref name="title"/>
patrick@0
   261
    </optional>
patrick@0
   262
    <optional>
patrick@0
   263
      <ref name="pagenumber"/>
patrick@0
   264
    </optional>
patrick@0
   265
  </define>
patrick@2
   266
  <!-- ~~~~~~ pagenumber -->
patrick@0
   267
  <define name="pagenumber">
patrick@0
   268
    <element name="pagenumber">
patrick@0
   269
      <ref name="pagenumber.attributes"/>
patrick@0
   270
    </element>
patrick@0
   271
  </define>
patrick@0
   272
  <define name="pagenumber.attributes">
patrick@0
   273
    <ref name="pagenumber.value.attribute"/>
patrick@0
   274
  </define>
patrick@0
   275
  <define name="pagenumber.value.attribute">
patrick@0
   276
    <attribute name="value">
patrick@0
   277
      <ref name="pagenumber.value.enumeration"/>
patrick@0
   278
    </attribute>
patrick@0
   279
  </define>
patrick@0
   280
  <define name="pagenumber.value.enumeration">
patrick@0
   281
    <data type="positiveInteger"/>
patrick@0
   282
  </define>
patrick@0
   283
  <!--
patrick@0
   284
    =============================================================================
patrick@20
   285
                                   DIVISION LEVEL
patrick@0
   286
    =============================================================================
patrick@0
   287
  -->
patrick@0
   288
  <define name="composition.division">
patrick@0
   289
    <element name="division">
patrick@0
   290
      <ref name="composition.division.attributes"/>
patrick@0
   291
      <ref name="composition.division.content"/>
patrick@0
   292
    </element>
patrick@0
   293
  </define>
patrick@0
   294
  <define name="selection.division">
patrick@0
   295
    <element name="division">
patrick@0
   296
      <ref name="selection.division.attributes"/>
patrick@0
   297
      <ref name="selection.division.content"/>
patrick@0
   298
    </element>
patrick@0
   299
  </define>
patrick@0
   300
  <define name="composition.division.attributes">
patrick@0
   301
    <interleave>
patrick@0
   302
      <optional>
patrick@0
   303
        <ref name="base.attribute"/>
patrick@0
   304
      </optional>
patrick@0
   305
      <ref name="remap.attributes"/>
patrick@0
   306
    </interleave>
patrick@0
   307
  </define>
patrick@0
   308
  <define name="selection.division.attributes">
patrick@0
   309
    <optional>
patrick@0
   310
      <ref name="base.attribute"/>
patrick@0
   311
    </optional>
patrick@0
   312
  </define>
patrick@0
   313
  <define name="composition.division.content">
patrick@0
   314
    <optional>
patrick@20
   315
      <ref name="composition.head"/>
patrick@0
   316
    </optional>
patrick@0
   317
    <oneOrMore>
patrick@0
   318
      <choice>
patrick@20
   319
        <ref name="composition.division"/>
patrick@0
   320
        <ref name="composition.file"/>
patrick@0
   321
      </choice>
patrick@0
   322
    </oneOrMore>
patrick@0
   323
  </define>
patrick@0
   324
  <define name="selection.division.content">
patrick@0
   325
    <optional>
patrick@20
   326
      <ref name="selection.head"/>
patrick@0
   327
    </optional>
patrick@0
   328
    <oneOrMore>
patrick@0
   329
      <choice>
patrick@20
   330
        <ref name="selection.division"/>
patrick@0
   331
        <ref name="selection.file"/>
patrick@0
   332
      </choice>
patrick@0
   333
    </oneOrMore>
patrick@0
   334
  </define>
patrick@0
   335
  <!--
patrick@0
   336
    =============================================================================
patrick@20
   337
                                     FILE LEVEL
patrick@0
   338
    =============================================================================
patrick@0
   339
  -->
patrick@0
   340
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   341
  <define name="composition.file">
patrick@0
   342
    <element name="file">
patrick@0
   343
      <ref name="composition.file.attributes"/>
patrick@2
   344
      <ref name="file.content"/>
patrick@0
   345
    </element>
patrick@0
   346
  </define>
patrick@0
   347
  <define name="selection.file">
patrick@0
   348
    <element name="file">
patrick@0
   349
      <ref name="selection.file.attributes"/>
patrick@2
   350
      <ref name="file.content"/>
patrick@0
   351
    </element>
patrick@0
   352
  </define>
patrick@0
   353
  <define name="composition.file.attributes">
patrick@0
   354
    <interleave>
patrick@0
   355
      <optional>
patrick@0
   356
        <ref name="xpath.attribute"/>
patrick@0
   357
      </optional>
patrick@20
   358
      <optional>
patrick@20
   359
        <ref name="transform.attribute"/>
patrick@20
   360
      </optional>
patrick@0
   361
      <ref name="remap.attributes"/>
patrick@0
   362
    </interleave>
patrick@0
   363
  </define>
patrick@0
   364
  <define name="selection.file.attributes">
patrick@20
   365
    <interleave>
patrick@20
   366
      <optional>
patrick@20
   367
        <ref name="xpath.attribute"/>
patrick@20
   368
      </optional>
patrick@20
   369
      <optional>
patrick@20
   370
        <ref name="transform.attribute"/>
patrick@20
   371
      </optional>
patrick@20
   372
    </interleave>
patrick@0
   373
  </define>
patrick@0
   374
  <define name="xpath.attribute">
patrick@0
   375
    <attribute name="xpath"/>
patrick@0
   376
  </define>
patrick@20
   377
  <define name="transform.attribute">
patrick@20
   378
    <attribute name="transform">
patrick@20
   379
      <list>
patrick@20
   380
        <oneOrMore>
patrick@20
   381
          <data type="token">
patrick@20
   382
            <param name="pattern">(xsl|regex):\S+</param>
patrick@20
   383
          </data>
patrick@20
   384
        </oneOrMore>
patrick@20
   385
      </list>
patrick@20
   386
    </attribute>
patrick@20
   387
  </define>
patrick@2
   388
  <define name="file.content">
patrick@2
   389
    <data type="anyURI"/>
patrick@2
   390
  </define>
patrick@0
   391
  <!--
patrick@0
   392
    =============================================================================
patrick@20
   393
                                    INLINE LEVEL
patrick@0
   394
    =============================================================================
patrick@0
   395
  -->
patrick@0
   396
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   397
  <define name="inlines">
patrick@0
   398
    <mixed>
patrick@0
   399
      <interleave>
patrick@0
   400
        <zeroOrMore>
patrick@0
   401
          <ref name="sup"/>
patrick@0
   402
        </zeroOrMore>
patrick@0
   403
        <zeroOrMore>
patrick@0
   404
          <ref name="sub"/>
patrick@0
   405
        </zeroOrMore>
patrick@0
   406
      </interleave>
patrick@0
   407
    </mixed>
patrick@0
   408
  </define>
patrick@0
   409
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
patrick@0
   410
  <define name="sup">
patrick@0
   411
    <element name="sup">
patrick@0
   412
      <ref name="inlines"/>
patrick@0
   413
    </element>
patrick@0
   414
  </define>
patrick@0
   415
  <define name="sub">
patrick@0
   416
    <element name="sub">
patrick@0
   417
      <ref name="inlines"/>
patrick@0
   418
    </element>
patrick@0
   419
  </define>
patrick@0
   420
  <!--
patrick@0
   421
    =============================================================================
patrick@20
   422
                                  REMAP ATTRIBUTES
patrick@0
   423
    =============================================================================
patrick@0
   424
  -->
patrick@0
   425
  <define name="remap.attributes">
patrick@0
   426
    <interleave>
patrick@0
   427
      <optional>
patrick@0
   428
        <ref name="as.attribute"/>
patrick@0
   429
      </optional>
patrick@0
   430
      <optional>
patrick@0
   431
        <ref name="attributes.attribute"/>
patrick@0
   432
      </optional>
patrick@0
   433
    </interleave>
patrick@0
   434
  </define>
patrick@0
   435
  <define name="as.attribute">
patrick@0
   436
    <attribute name="as">
patrick@0
   437
      <data type="QName"/>
patrick@0
   438
    </attribute>
patrick@0
   439
  </define>
patrick@0
   440
  <define name="attributes.attribute">
patrick@0
   441
    <attribute name="attributes">
patrick@0
   442
      <list>
patrick@0
   443
        <oneOrMore>
patrick@0
   444
          <data type="token">
patrick@0
   445
            <param name="pattern">\c+=\S+</param>
patrick@0
   446
          </data>
patrick@0
   447
        </oneOrMore>
patrick@0
   448
      </list>
patrick@0
   449
    </attribute>
patrick@0
   450
  </define>
patrick@0
   451
</grammar>