RelaxNG/publidoc.rnc
changeset 2 417bb62f2a77
parent 0 41a5385c69a2
child 3 59e42ac69f8f
equal deleted inserted replaced
1:5f332cc7150a 2:417bb62f2a77
     6 publidoc = element publidoc {
     6 publidoc = element publidoc {
     7    publidoc.attributes,
     7    publidoc.attributes,
     8    publidoc.content
     8    publidoc.content
     9 }
     9 }
    10 
    10 
    11 # ~~~~~~ attributes
       
    12 publidoc.attributes =
    11 publidoc.attributes =
    13    version.attribute
    12    version.attribute
    14 
       
    15 version.attribute = attribute version { "1.0" }
    13 version.attribute = attribute version { "1.0" }
    16 
    14 
    17 # ~~~~~~ content
       
    18 publidoc.content =
    15 publidoc.content =
    19    document
    16    document
    20  | top.topic
    17  | top.topic
    21 
    18 
    22 
    19 
    26 
    23 
    27 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    24 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    28 
    25 
    29 document = element document { document.attributes, document.content }
    26 document = element document { document.attributes, document.content }
    30 
    27 
    31 # ~~~~~~ attributes
       
    32 document.attributes =
    28 document.attributes =
    33    document.id.attribute
    29    document.id.attribute
    34 
       
    35 document.id.attribute = attribute xml:id { xsd:ID }
    30 document.id.attribute = attribute xml:id { xsd:ID }
    36 
    31 
    37 # ~~~~~~ content
       
    38 document.content =
    32 document.content =
    39    metadata?,
    33    metadata?,
    40    (division+ | topic+)
    34    (division+ | topic+)
    41 
    35 
    42 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    36 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    63  & source*
    57  & source*
    64  & subjectset?
    58  & subjectset?
    65  & abstract?
    59  & abstract?
    66  & annotation*
    60  & annotation*
    67 
    61 
    68 language = element language { language.attributes }
       
    69 language.attributes = lang.attribute
       
    70 lang.attribute = attribute xml:lang { xsd:language }
       
    71 
       
    72 place = element place { place.content }
       
    73 place.content = inlines
       
    74 
       
    75 abstract = element abstract { abstract.content }
       
    76 abstract.content = parag+
       
    77 
       
    78 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    62 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ title, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    79 
    63 
    80 title = element title { title.content }
    64 title = element title { title.content }
       
    65 
    81 title.content = inlines
    66 title.content = inlines
    82 
    67 
    83 subtitle = element subtitle { title.content }
    68 subtitle = element subtitle { title.content }
    84 
    69 
    85 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    70 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ author, publisher ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    92 
    77 
    93 publisher = element publisher { publisher.content }
    78 publisher = element publisher { publisher.content }
    94 
    79 
    95 publisher.content = inlines
    80 publisher.content = inlines
    96 
    81 
       
    82 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    83 
       
    84 language = element language { language.attributes }
       
    85 
       
    86 language.attributes = lang.attribute
       
    87 lang.attribute = attribute xml:lang { xsd:language }
       
    88 
       
    89 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ place ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    90 
       
    91 place = element place { place.content }
       
    92 
       
    93 place.content = inlines
       
    94 
    97 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    95 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    98 
    96 
       
    97 # ~~~~~~ source
    99 source = element source {
    98 source = element source {
   100    source.attributes,
    99    source.attributes,
   101    (  (attribute type { "book" }, source.content.book)
   100    (  (attribute type { "book" }, source.content.book)
   102     | (attribute type { "file" })),
   101     | (attribute type { "file" })),
   103    source.content
   102    source.content
   104 }
   103 }
   105 
   104 
   106 # ~~~~~~ Attributes
       
   107 source.attributes =
   105 source.attributes =
   108    source.id.attribute
   106    source.id.attribute
   109 
       
   110 source.id.attribute = attribute id { xsd:NMTOKEN }
   107 source.id.attribute = attribute id { xsd:NMTOKEN }
   111 
   108 
   112 # ~~~~~~ Content
       
   113 source.content.book =
   109 source.content.book =
   114    title,
   110    title,
   115    pagenumber*
   111    pagenumber*
   116 
       
   117 source.content =
   112 source.content =
   118    annotation*
   113    annotation*
   119 
   114 
       
   115 # ~~~~~~ pagenumber
   120 pagenumber = element pagenumber { pagenumber.attributes }
   116 pagenumber = element pagenumber { pagenumber.attributes }
       
   117 
   121 pagenumber.attributes =
   118 pagenumber.attributes =
   122    pagenumber.value.attribute
   119    pagenumber.value.attribute
   123 pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
   120 pagenumber.value.attribute = attribute value { pagenumber.value.enumeration }
   124 pagenumber.value.enumeration = xsd:positiveInteger
   121 pagenumber.value.enumeration = xsd:positiveInteger
   125 
   122 
   126 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   123 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   127 
   124 
       
   125 # ~~~~~~ subjectset
   128 subjectset = element subjectset { subjectset.content }
   126 subjectset = element subjectset { subjectset.content }
   129 
   127 
   130 subjectset.content = subject+
   128 subjectset.content = subject+
   131 
   129 
       
   130 # ~~~~~~ subject
   132 subject = element subject { subject.attributes }
   131 subject = element subject { subject.attributes }
       
   132 
   133 subject.attributes =
   133 subject.attributes =
   134    subject.id.attribute
   134    subject.id.attribute
   135 subject.id.attribute = attribute id { xsd:NMTOKEN }
   135 subject.id.attribute = attribute id { xsd:NMTOKEN }
   136 
   136 
       
   137 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
   138 
       
   139 abstract = element abstract { abstract.content }
       
   140 
       
   141 abstract.content =
       
   142    parag+
       
   143 
   137 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   144 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ annotation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   138 
   145 
   139 annotation = element annotation { annotation.content }
   146 annotation = element annotation { annotation.content }
   140 
   147 
   141 annotation.content = inlines
   148 annotation.content = inlines
   160 
   167 
   161 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   168 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ topic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   162 
   169 
   163 topic = element topic { topic.attributes, topic.content }
   170 topic = element topic { topic.attributes, topic.content }
   164 
   171 
   165 # ~~~~~~ attributes
       
   166 top.topic.attributes =
   172 top.topic.attributes =
   167    topic.id.attribute
   173    topic.id.attribute
   168  & topic.type.attribute?
   174  & topic.type.attribute?
   169 
       
   170 topic.attributes =
   175 topic.attributes =
   171    topic.id.attribute?
   176    topic.id.attribute?
   172  & topic.type.attribute?
   177  & topic.type.attribute?
   173 
       
   174 topic.id.attribute = attribute xml:id { xsd:ID }
   178 topic.id.attribute = attribute xml:id { xsd:ID }
   175 
       
   176 topic.type.attribute = attribute type { xsd:NCName }
   179 topic.type.attribute = attribute type { xsd:NCName }
   177 
   180 
   178 # ~~~~~~ content
       
   179 topic.content =
   181 topic.content =
   180    metadata?,
   182    metadata?,
   181    section+
   183    section+
   182 
   184 
   183 
   185 
   211    inlines
   213    inlines
   212  & link*
   214  & link*
   213 
   215 
   214 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   216 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ media ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   215 
   217 
       
   218 # ~~~~~~ media
   216 media = element media { media.content }
   219 media = element media { media.content }
   217 
   220 
   218 media.content =
   221 media.content =
   219    image+,
   222    image+,
   220    media.caption?
   223    media.caption?
   221 
   224 
   222 media.id.attribute = attribute id { xsd:NMTOKEN }
   225 media.id.attribute = attribute id { xsd:NMTOKEN }
   223 
   226 
       
   227 # ~~~~~~ caption
   224 media.caption = element caption { media.caption.content }
   228 media.caption = element caption { media.caption.content }
   225 media.caption.content = parag+
   229 
   226 
   230 media.caption.content =
   227 # ~~~~~~ Image
   231    parag+
       
   232 
       
   233 # ~~~~~~ image
   228 image = element image { image.attributes, image.content }
   234 image = element image { image.attributes, image.content }
   229 
   235 
   230 image.attributes =
   236 image.attributes =
   231    media.id.attribute
   237    media.id.attribute
   232 
   238 
   233 image.content =
   239 image.content =
   234    copyright?
   240    copyright?
   235 
   241 
       
   242 # ~~~~~~ copyright
   236 copyright = element copyright { copyright.content }
   243 copyright = element copyright { copyright.content }
   237 copyright.content = inlines
   244 copyright.content = inlines
   238 
   245 
   239 
   246 
   240 # =============================================================================
   247 # =============================================================================
   267 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   274 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   268 
   275 
   269 date = element date { date.attributes, date.content }
   276 date = element date { date.attributes, date.content }
   270 
   277 
   271 date.attributes = date.of.attribute
   278 date.attributes = date.of.attribute
   272 
       
   273 date.of.attribute = attribute of { date.of.enumeration }
   279 date.of.attribute = attribute of { date.of.enumeration }
   274 date.of.enumeration = "event" | "birth" | "death"
   280 date.of.enumeration = "event" | "birth" | "death"
   275 
   281 
   276 date.content = xsd:date | xsd:gYearMonth | xsd:gYear
   282 date.content = xsd:date | xsd:gYearMonth | xsd:gYear
   277 
   283 
   278 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   284 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   279 
   285 
   280 firstname = element firstname { inlines }
   286 firstname = element firstname { inlines }
   281 
   287 
   282 lastname = element lastname { inlines }
   288 lastname = element lastname { inlines }
   283 
   289 
   284 name = element name { name.attributes, name.content }
   290 name = element name { name.attributes, name.content }
   285 name.attributes = name.of.attribute?
   291 
   286 name.content = inlines
   292 name.attributes =
       
   293    name.of.attribute?
   287 name.of.attribute = attribute of { name.of.enumeration }
   294 name.of.attribute = attribute of { name.of.enumeration }
   288 name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party"
   295 name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party"
   289 
   296 
       
   297 name.content = inlines
       
   298 
   290 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footnote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   299 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ footnote ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   291 
   300 
   292 footnote = element footnote { footnote.attributes, footnote.content }
   301 footnote = element footnote { footnote.attributes, footnote.content }
   293 
   302 
   294 footnote.attributes = footnote.label.attribute?
   303 footnote.attributes =
   295 
   304    footnote.label.attribute?
   296 footnote.label.attribute = attribute label { text }
   305 footnote.label.attribute = attribute label { text }
   297 
   306 
   298 footnote.content = parag+
   307 footnote.content =
       
   308    parag+
   299 
   309 
   300 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   310 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foreign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   301 
   311 
   302 foreign = element foreign { foreign.attributes, foreign.content }
   312 foreign = element foreign { foreign.attributes, foreign.content }
   303 
   313