RelaxNG/publiset.rnc
author Patrick PIERRE <patrick.pierre@prismallia.fr>
dim., 05 juin 2011 23:51:15 +0200
changeset 4 1db220a61526
parent 2 417bb62f2a77
child 5 69310bc35b63
permissions -rw-r--r--
Suppression des fichiers schemas.xml
patrick@0
     1
# $Id$
patrick@0
     2
patrick@0
     3
start = publiset
patrick@0
     4
patrick@0
     5
patrick@0
     6
publiset = element publiset {
patrick@0
     7
   publiset.attributes,
patrick@0
     8
   publiset.content
patrick@0
     9
}
patrick@0
    10
patrick@0
    11
publiset.attributes =
patrick@0
    12
   version.attribute
patrick@0
    13
version.attribute = attribute version { "1.0" }
patrick@0
    14
patrick@0
    15
publiset.content =
patrick@0
    16
   (composition | selection)+
patrick@0
    17
patrick@0
    18
patrick@0
    19
# =============================================================================
patrick@0
    20
#                                  Top level
patrick@0
    21
# =============================================================================
patrick@0
    22
patrick@0
    23
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    24
patrick@0
    25
composition = element composition {
patrick@0
    26
   composition.attributes,
patrick@0
    27
   composition.content
patrick@0
    28
}
patrick@0
    29
patrick@0
    30
composition.attributes =
patrick@0
    31
   composition.id.attribute
patrick@0
    32
 & base.attribute?
patrick@0
    33
 & remap.attributes
patrick@0
    34
composition.id.attribute = attribute xml:id { xsd:ID }
patrick@0
    35
base.attribute = attribute xml:base { xsd:anyURI }
patrick@0
    36
patrick@0
    37
composition.content =
patrick@0
    38
   composition.metadata?,
patrick@0
    39
   (composition.file | composition.division)+
patrick@0
    40
patrick@0
    41
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    42
patrick@0
    43
selection = element selection {
patrick@0
    44
   selection.attributes,
patrick@0
    45
   selection.content
patrick@0
    46
}
patrick@0
    47
patrick@0
    48
selection.attributes =
patrick@0
    49
   base.attribute?
patrick@0
    50
selection.id.attribute = attribute xml:id { xsd:ID }
patrick@0
    51
patrick@0
    52
selection.content =
patrick@0
    53
   selection.metadata?,
patrick@0
    54
   (selection.file | selection.division)+
patrick@0
    55
patrick@0
    56
patrick@0
    57
# =============================================================================
patrick@0
    58
#                                 Metadata level
patrick@0
    59
# =============================================================================
patrick@0
    60
patrick@0
    61
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    62
patrick@0
    63
composition.metadata = element metadata {
patrick@0
    64
   metadata.attributes,
patrick@0
    65
   metadata.content
patrick@0
    66
}
patrick@0
    67
selection.metadata = element metadata { metadata.content }
patrick@0
    68
patrick@0
    69
metadata.attributes =
patrick@0
    70
   remap.attributes
patrick@0
    71
patrick@0
    72
metadata.content =
patrick@0
    73
   title?,
patrick@0
    74
   subtitle?,
patrick@0
    75
   source?
patrick@0
    76
patrick@0
    77
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    78
patrick@0
    79
title = element title { title.content }
patrick@2
    80
patrick@0
    81
title.content = inlines
patrick@0
    82
patrick@0
    83
subtitle = element subtitle { title.content }
patrick@0
    84
patrick@0
    85
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
    86
patrick@2
    87
# ~~~~~~ source
patrick@0
    88
source = element source {
patrick@0
    89
   source.attributes,
patrick@0
    90
   (  (attribute type { "book" }, source.content.book)
patrick@0
    91
    | (attribute type { "file" }))
patrick@0
    92
}
patrick@0
    93
patrick@0
    94
source.attributes =
patrick@0
    95
   source.id.attribute?
patrick@0
    96
 & remap.attributes
patrick@0
    97
source.id.attribute = attribute id { xsd:NMTOKEN }
patrick@0
    98
patrick@0
    99
source.content.book =
patrick@0
   100
   title?,
patrick@0
   101
   pagenumber?
patrick@0
   102
patrick@2
   103
# ~~~~~~ pagenumber
patrick@0
   104
pagenumber = element pagenumber { pagenumber.attributes }
patrick@2
   105
patrick@0
   106
pagenumber.attributes =
patrick@0
   107
   pagenumber.value.attribute
patrick@0
   108
pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
patrick@0
   109
pagenumber.value.enumeration = xsd:positiveInteger
patrick@0
   110
patrick@0
   111
patrick@0
   112
# =============================================================================
patrick@0
   113
#                                Division level
patrick@0
   114
# =============================================================================
patrick@0
   115
patrick@0
   116
composition.division = element division {
patrick@0
   117
   composition.division.attributes,
patrick@0
   118
   composition.division.content
patrick@0
   119
}
patrick@0
   120
selection.division = element division {
patrick@0
   121
   selection.division.attributes,
patrick@0
   122
   selection.division.content
patrick@0
   123
}
patrick@0
   124
patrick@0
   125
composition.division.attributes =
patrick@0
   126
   base.attribute?
patrick@0
   127
 & remap.attributes
patrick@0
   128
selection.division.attributes =
patrick@0
   129
   base.attribute?
patrick@0
   130
patrick@0
   131
composition.division.content =
patrick@0
   132
   composition.metadata?,
patrick@0
   133
   (composition.file | composition.division)+
patrick@0
   134
selection.division.content =
patrick@0
   135
   selection.metadata?,
patrick@0
   136
   (selection.file | selection.division)+
patrick@0
   137
patrick@0
   138
patrick@0
   139
# =============================================================================
patrick@0
   140
#                                  File level
patrick@0
   141
# =============================================================================
patrick@0
   142
patrick@0
   143
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   144
patrick@2
   145
composition.file = element file { composition.file.attributes, file.content }
patrick@2
   146
selection.file = element file { selection.file.attributes, file.content }
patrick@0
   147
patrick@0
   148
composition.file.attributes =
patrick@2
   149
   xpath.attribute?
patrick@0
   150
 & remap.attributes
patrick@0
   151
selection.file.attributes =
patrick@2
   152
   xpath.attribute?
patrick@0
   153
xpath.attribute = attribute xpath { text }
patrick@0
   154
patrick@2
   155
file.content = xsd:anyURI
patrick@2
   156
   
patrick@0
   157
# =============================================================================
patrick@0
   158
#                                 Inline level
patrick@0
   159
# =============================================================================
patrick@0
   160
patrick@0
   161
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   162
patrick@0
   163
inlines = mixed {
patrick@0
   164
   sup*
patrick@0
   165
 & sub*
patrick@0
   166
}
patrick@0
   167
patrick@0
   168
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
patrick@0
   169
patrick@0
   170
sup = element sup { inlines }
patrick@0
   171
patrick@0
   172
sub = element sub { inlines }
patrick@0
   173
patrick@0
   174
patrick@0
   175
# =============================================================================
patrick@0
   176
#                               Remap attributes
patrick@0
   177
# =============================================================================
patrick@0
   178
patrick@0
   179
remap.attributes =
patrick@0
   180
   as.attribute?
patrick@0
   181
 & attributes.attribute?
patrick@0
   182
as.attribute = attribute as { xsd:QName }
patrick@0
   183
attributes.attribute =
patrick@0
   184
   attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}