RelaxNG/publiset.rnc
changeset 96 4817d2fa8801
parent 66 29c53c3d676e
child 97 e28caa4cbf4c
equal deleted inserted replaced
95:51aff0bf9d8b 96:4817d2fa8801
    20 #                                  TOP LEVEL
    20 #                                  TOP LEVEL
    21 # =============================================================================
    21 # =============================================================================
    22 
    22 
    23 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    23 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ composition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    24 
    24 
       
    25 # ~~~~~~ composition
    25 composition = element composition {
    26 composition = element composition {
    26    composition.attributes,
    27    composition.attributes,
    27    composition.content
    28    composition.content
    28 }
    29 }
    29 
    30 
    42 
    43 
    43 composition.content =
    44 composition.content =
    44    composition.head?,
    45    composition.head?,
    45    (composition.division | composition.file)+
    46    (composition.division | composition.file)+
    46 
    47 
    47 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    48 # ~~~~~~ composition.head
    48 
    49 composition.head = element head {
    49 selection = element selection {
    50    composition.head.attributes, composition.head.content }
    50    selection.attributes,
    51 
    51    selection.content
    52 composition.head.attributes =
    52 }
       
    53 
       
    54 selection.attributes =
       
    55    selection.id.attribute
       
    56  & path.attribute?
       
    57  & lang.attribute?
       
    58 selection.id.attribute = attribute xml:id { xsd:ID }
       
    59 
       
    60 selection.content =
       
    61    selection.head?,
       
    62    (selection.division | selection.file | link)+
       
    63 
       
    64 
       
    65 # =============================================================================
       
    66 #                                  HEAD LEVEL
       
    67 # =============================================================================
       
    68 
       
    69 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    70 
       
    71 composition.head = element head { head.attributes, top.head.content }
       
    72 selection.head = element head { top.head.content }
       
    73 division.head = element head { division.head.content }
       
    74 
       
    75 head.attributes =
       
    76    remap.attributes
    53    remap.attributes
    77 
    54 
    78 top.head.content =
    55 composition.head.content =
    79    (title, subtitle?)?
    56    (title, subtitle?)?
    80  & identifier*
    57  & identifier*
    81  & copyright?
    58  & copyright?
    82  & contributors?
    59  & contributors?
    83  & abstract?
    60  & abstract?
    84  & cover?
    61  & cover?
    85 division.head.content =
    62 
    86    (title, subtitle?)?
    63 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    87 
    64 
    88 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    65 # ~~~~~~ selection
    89 
    66 selection = element selection {
    90 title = element title { title.content }
    67    selection.attributes,
    91 subtitle = element subtitle { title.content }
    68    selection.content
    92 
    69 }
    93 title.content = inlines
    70 
    94 
    71 selection.attributes =
    95 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    72    selection.id.attribute
    96 
    73  & path.attribute?
    97 identifier.uri = element identifier {
    74  & lang.attribute?
    98    attribute type { "uri" }, xsd:anyURI
    75 selection.id.attribute = attribute xml:id { xsd:ID }
    99 }
    76 
   100 
    77 selection.content =
   101 identifier.ean = element identifier {
    78    selection.head?,
   102    attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
    79    (selection.division | selection.file | link)+
   103 }
    80 
   104 
    81 # ~~~~~~ selection.head
   105 identifier = identifier.uri | identifier.ean
    82 selection.head = element head { composition.head.content }
   106 
       
   107 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   108 
       
   109 copyright = element copyright { copyright.content }
       
   110 
       
   111 copyright.content = inlines
       
   112 
       
   113 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   114 
       
   115 # ~~~~~~ contributors
       
   116 contributors = element contributors { contributors.content }
       
   117 
       
   118 contributors.content =
       
   119    contributor+
       
   120 
       
   121 # ~~~~~~ contributor
       
   122 contributor = element contributor { contributor.content }
       
   123 
       
   124 contributor.content =
       
   125    (((firstname, secondname?)?, lastname) | label),
       
   126    address?,
       
   127    link?,
       
   128    role*
       
   129 
       
   130 # ~~~~~~ firstname, secondname, lastname, label
       
   131 firstname = element firstname { firstname.content }
       
   132 secondname = element secondname { secondname.content }
       
   133 lastname = element lastname { lastname.content }
       
   134 label = element label { label.content }
       
   135 
       
   136 firstname.content = inlines
       
   137 secondname.content = inlines
       
   138 lastname.content = inlines
       
   139 label.content = inlines
       
   140 
       
   141 # ~~~~~~ address
       
   142 address = element address { address.content }
       
   143 
       
   144 address.content = inlines
       
   145 
       
   146 # ~~~~~~ role
       
   147 role = element role { role.content }
       
   148 
       
   149 role.content = "author" | "illustrator" | "publisher"
       
   150 
       
   151 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   152 
       
   153 abstract = element abstract { abstract.content }
       
   154 
       
   155 abstract.content =
       
   156    p+
       
   157 
       
   158 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   159 
       
   160 cover = element cover { cover.content }
       
   161 
       
   162 cover.content =
       
   163    cover.image
       
   164 
       
   165 cover.image = element image { cover.image.attributes }
       
   166 
       
   167 cover.image.attributes =
       
   168    cover.image.id.attribute
       
   169 cover.image.id.attribute = attribute id { xsd:NMTOKEN }
       
   170 
    83 
   171 
    84 
   172 # =============================================================================
    85 # =============================================================================
   173 #                                DIVISION LEVEL
    86 #                                DIVISION LEVEL
   174 # =============================================================================
    87 # =============================================================================
   175 
    88 
       
    89 # ~~~~~~ division
   176 composition.division = element division {
    90 composition.division = element division {
   177    composition.division.attributes,
    91    composition.division.attributes,
   178    composition.division.content
    92    composition.division.content
   179 }
    93 }
   180 selection.division = element division {
    94 selection.division = element division {
   184 
    98 
   185 composition.division.attributes =
    99 composition.division.attributes =
   186    path.attribute?
   100    path.attribute?
   187  & xpath.attribute?
   101  & xpath.attribute?
   188  & xslt.attribute?
   102  & xslt.attribute?
       
   103  & transform.attribute?
   189  & remap.attributes
   104  & remap.attributes
   190 selection.division.attributes =
   105 selection.division.attributes =
   191    path.attribute?
   106    path.attribute?
       
   107 transform.attribute = attribute transform { xsd:anyURI }
   192 
   108 
   193 composition.division.content =
   109 composition.division.content =
   194    composition.head?,
   110    composition.head?,
   195    (composition.division | composition.file)+
   111    (composition.division | composition.file)+
   196 selection.division.content =
   112 selection.division.content =
   197    selection.head?,
   113    selection.head?,
   198    (selection.division | selection.file | link)+
   114    (selection.division | selection.file | link)+
       
   115 
       
   116 # ~~~~~~ division.head
       
   117 division.head = element head { division.head.content }
       
   118 
       
   119 division.head.content =
       
   120    (title, subtitle?)?
   199 
   121 
   200 
   122 
   201 # =============================================================================
   123 # =============================================================================
   202 #                                  FILE LEVEL
   124 #                                  FILE LEVEL
   203 # =============================================================================
   125 # =============================================================================
   230 p.content =
   152 p.content =
   231    inlines
   153    inlines
   232 
   154 
   233 
   155 
   234 # =============================================================================
   156 # =============================================================================
       
   157 #                                  HEAD LEVEL
       
   158 # =============================================================================
       
   159 
       
   160 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   161 
       
   162 title = element title { title.content }
       
   163 subtitle = element subtitle { title.content }
       
   164 
       
   165 title.content = inlines
       
   166 
       
   167 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   168 
       
   169 identifier.uri = element identifier {
       
   170    attribute type { "uri" }, xsd:anyURI
       
   171 }
       
   172 
       
   173 identifier.ean = element identifier {
       
   174    attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
       
   175 }
       
   176 
       
   177 identifier = identifier.uri | identifier.ean
       
   178 
       
   179 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   180 
       
   181 copyright = element copyright { copyright.content }
       
   182 
       
   183 copyright.content = inlines
       
   184 
       
   185 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   186 
       
   187 # ~~~~~~ contributors
       
   188 contributors = element contributors { contributors.content }
       
   189 
       
   190 contributors.content =
       
   191    contributor+
       
   192 
       
   193 # ~~~~~~ contributor
       
   194 contributor = element contributor { contributor.content }
       
   195 
       
   196 contributor.content =
       
   197    (((firstname, secondname?)?, lastname) | label),
       
   198    address?,
       
   199    link?,
       
   200    role*
       
   201 
       
   202 # ~~~~~~ firstname, secondname, lastname, label
       
   203 firstname = element firstname { firstname.content }
       
   204 secondname = element secondname { secondname.content }
       
   205 lastname = element lastname { lastname.content }
       
   206 label = element label { label.content }
       
   207 
       
   208 firstname.content = inlines
       
   209 secondname.content = inlines
       
   210 lastname.content = inlines
       
   211 label.content = inlines
       
   212 
       
   213 # ~~~~~~ address
       
   214 address = element address { address.content }
       
   215 
       
   216 address.content = inlines
       
   217 
       
   218 # ~~~~~~ role
       
   219 role = element role { role.content }
       
   220 
       
   221 role.content = "author" | "illustrator" | "publisher"
       
   222 
       
   223 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   224 
       
   225 abstract = element abstract { abstract.content }
       
   226 
       
   227 abstract.content =
       
   228    p+
       
   229 
       
   230 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cover ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   231 
       
   232 cover = element cover { cover.content }
       
   233 
       
   234 cover.content =
       
   235    cover.image
       
   236 
       
   237 cover.image = element image { cover.image.attributes }
       
   238 
       
   239 cover.image.attributes =
       
   240    cover.image.id.attribute
       
   241 cover.image.id.attribute = attribute id { xsd:NMTOKEN }
       
   242 
       
   243 
       
   244 # =============================================================================
   235 #                                 INLINE LEVEL
   245 #                                 INLINE LEVEL
   236 # =============================================================================
   246 # =============================================================================
   237 
   247 
   238 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   248 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   239 
   249