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