RelaxNG/publiset.rnc
changeset 38 3c8b406be906
parent 36 d23cfb7be79e
child 39 7faa356bad3e
equal deleted inserted replaced
37:83b7ec3c3132 38:3c8b406be906
    91 
    91 
    92 title.content = inlines
    92 title.content = inlines
    93 
    93 
    94 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    94 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    95 
    95 
    96 identifier = element identifier { identifier.content, identifier.attributes }
    96 identifier.uri = element identifier {
    97 
    97    attribute type { "uri" }, xsd:anyURI
    98 identifier.attributes =
    98 }
    99    class.attribute
    99 
   100 class.attribute = attribute class { "uri" | "ean" }
   100 identifier.ean = element identifier {
   101 
   101    attribute type { "ean" }, xsd:token {pattern = "\d{13}"}
   102 identifier.content =  xsd:anyURI | xsd:NMTOKEN
   102 }
       
   103 
       
   104 identifier = identifier.uri | identifier.ean
   103 
   105 
   104 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   106 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   105 
   107 
   106 language = element language { language.attributes }
   108 language = element language { language.attributes }
   107 
   109 
   137 # ~~~~~~ lastname
   139 # ~~~~~~ lastname
   138 lastname = element lastname { lastname.content }
   140 lastname = element lastname { lastname.content }
   139 
   141 
   140 lastname.content = inlines
   142 lastname.content = inlines
   141 
   143 
   142 # ~~~~~~ label
       
   143 label = element label { label.content }
       
   144 
       
   145 label.content = inlines
       
   146 
       
   147 # ~~~~~~ role
   144 # ~~~~~~ role
   148 role = element role { role.attributes }
   145 role = element role { role.attributes }
   149 
   146 
   150 role.attributes =
   147 role.attributes =
   151    role.of.attribute
   148    role.of.attribute
   152 role.of.attribute = attribute of { "author" | "illustrator" }
   149 role.of.attribute = attribute of { "author" | "illustrator" }
   153 
   150 
       
   151 # ~~~~~~ label
       
   152 label = element label { label.content }
       
   153 
       
   154 label.content = inlines
       
   155 
   154 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   156 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   155 
   157 
   156 # ~~~~~~ source
   158 # ~~~~~~ source
   157 source = element source {
   159 source = element source {
   158    source.attributes,
       
   159    (  (attribute type { "book" }, source.content.book)
   160    (  (attribute type { "book" }, source.content.book)
   160     | (attribute type { "file" }))
   161     | (attribute type { "file" }, source.content.file))
   161 }
   162 }
   162 
       
   163 source.attributes =
       
   164    source.id.attribute?
       
   165  & remap.attributes
       
   166 source.id.attribute = attribute id { xsd:NMTOKEN }
       
   167 
   163 
   168 source.content.book =
   164 source.content.book =
       
   165    identifier.ean,
   169    title?,
   166    title?,
   170    pagenumber?
   167    pagenumber*
       
   168 source.content.file =
       
   169    identifier.uri
   171 
   170 
   172 # ~~~~~~ pagenumber
   171 # ~~~~~~ pagenumber
   173 pagenumber = element pagenumber { pagenumber.attributes }
   172 pagenumber = element pagenumber { pagenumber.attributes }
   174 
   173 
   175 pagenumber.attributes =
   174 pagenumber.attributes =