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