RelaxNG/publiset.rnc
changeset 20 79713ffae179
parent 18 e448c6a000e5
child 21 7c09024d5634
equal deleted inserted replaced
19:7141fd097b97 20:79713ffae179
    15 publiset.content =
    15 publiset.content =
    16    (composition | selection)+
    16    (composition | selection)+
    17 
    17 
    18 
    18 
    19 # =============================================================================
    19 # =============================================================================
    20 #                                  Top level
    20 #                                  TOP LEVEL
    21 # =============================================================================
    21 # =============================================================================
    22 
    22 
    23 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    23 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    24 
    24 
    25 composition = element composition {
    25 composition = element composition {
    33  & remap.attributes
    33  & remap.attributes
    34 composition.id.attribute = attribute xml:id { xsd:ID }
    34 composition.id.attribute = attribute xml:id { xsd:ID }
    35 base.attribute = attribute xml:base { xsd:anyURI }
    35 base.attribute = attribute xml:base { xsd:anyURI }
    36 
    36 
    37 composition.content =
    37 composition.content =
    38    composition.metadata?,
    38    composition.head?,
    39    (composition.file | composition.division)+
    39    (composition.file | composition.division)+
    40 
    40 
    41 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    41 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    42 
    42 
    43 selection = element selection {
    43 selection = element selection {
    48 selection.attributes =
    48 selection.attributes =
    49    base.attribute?
    49    base.attribute?
    50 selection.id.attribute = attribute xml:id { xsd:ID }
    50 selection.id.attribute = attribute xml:id { xsd:ID }
    51 
    51 
    52 selection.content =
    52 selection.content =
    53    selection.metadata?,
    53    selection.head?,
    54    (selection.file | selection.division)+
    54    (selection.file | selection.division)+
    55 
    55 
    56 
    56 
    57 # =============================================================================
    57 # =============================================================================
    58 #                                 Metadata level
    58 #                                  HEAD LEVEL
    59 # =============================================================================
    59 # =============================================================================
    60 
    60 
    61 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    61 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    62 
    62 
    63 composition.metadata = element metadata {
    63 composition.head = element head { head.attributes, top.head.content }
    64    metadata.attributes,
    64 selection.head = element head { top.head.content }
    65    metadata.content
    65 division.head = element head { division.head.content }
    66 }
    66 
    67 selection.metadata = element metadata { metadata.content }
    67 head.attributes =
    68 
       
    69 metadata.attributes =
       
    70    remap.attributes
    68    remap.attributes
    71 
    69 
    72 metadata.content =
    70 top.head.content =
    73    (title, subtitle?)?
    71    (title, subtitle?)?
    74  & language?
    72  & language?
    75  & author*
    73  & author*
    76  & publisher?
    74  & publisher?
    77  & source?
    75  & source?
       
    76 division.head.content =
       
    77    (title, subtitle?)?
       
    78  & language?
       
    79  & annotation*
    78 
    80 
    79 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    81 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    80 
    82 
    81 title = element title { title.content }
    83 title = element title { title.content }
    82 subtitle = element subtitle { title.content }
    84 subtitle = element subtitle { title.content }
   140 pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
   142 pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
   141 pagenumber.value.enumeration = xsd:positiveInteger
   143 pagenumber.value.enumeration = xsd:positiveInteger
   142 
   144 
   143 
   145 
   144 # =============================================================================
   146 # =============================================================================
   145 #                                Division level
   147 #                                DIVISION LEVEL
   146 # =============================================================================
   148 # =============================================================================
   147 
   149 
   148 composition.division = element division {
   150 composition.division = element division {
   149    composition.division.attributes,
   151    composition.division.attributes,
   150    composition.division.content
   152    composition.division.content
   159  & remap.attributes
   161  & remap.attributes
   160 selection.division.attributes =
   162 selection.division.attributes =
   161    base.attribute?
   163    base.attribute?
   162 
   164 
   163 composition.division.content =
   165 composition.division.content =
   164    composition.metadata?,
   166    composition.head?,
   165    (composition.file | composition.division)+
   167    (composition.division | composition.file)+
   166 selection.division.content =
   168 selection.division.content =
   167    selection.metadata?,
   169    selection.head?,
   168    (selection.file | selection.division)+
   170    (selection.division | selection.file)+
   169 
   171 
   170 
   172 
   171 # =============================================================================
   173 # =============================================================================
   172 #                                  File level
   174 #                                  FILE LEVEL
   173 # =============================================================================
   175 # =============================================================================
   174 
   176 
   175 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   177 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   176 
   178 
   177 composition.file = element file { composition.file.attributes, file.content }
   179 composition.file = element file { composition.file.attributes, file.content }
   178 selection.file = element file { selection.file.attributes, file.content }
   180 selection.file = element file { selection.file.attributes, file.content }
   179 
   181 
   180 composition.file.attributes =
   182 composition.file.attributes =
   181    xpath.attribute?
   183    xpath.attribute?
       
   184  & transform.attribute?
   182  & remap.attributes
   185  & remap.attributes
   183 selection.file.attributes =
   186 selection.file.attributes =
   184    xpath.attribute?
   187    xpath.attribute?
       
   188  & transform.attribute?
   185 xpath.attribute = attribute xpath { text }
   189 xpath.attribute = attribute xpath { text }
       
   190 transform.attribute =
       
   191    attribute transform {list { (xsd:token {pattern = "(xsl|regex):\S+"})+ }}
   186 
   192 
   187 file.content = xsd:anyURI
   193 file.content = xsd:anyURI
   188    
   194    
   189 # =============================================================================
   195 # =============================================================================
   190 #                                 Inline level
   196 #                                 INLINE LEVEL
   191 # =============================================================================
   197 # =============================================================================
   192 
   198 
   193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   199 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   194 
   200 
   195 inlines = mixed {
   201 inlines = mixed {
   203 
   209 
   204 sub = element sub { inlines }
   210 sub = element sub { inlines }
   205 
   211 
   206 
   212 
   207 # =============================================================================
   213 # =============================================================================
   208 #                               Remap attributes
   214 #                               REMAP ATTRIBUTES
   209 # =============================================================================
   215 # =============================================================================
   210 
   216 
   211 remap.attributes =
   217 remap.attributes =
   212    as.attribute?
   218    as.attribute?
   213  & attributes.attribute?
   219  & attributes.attribute?