--- /dev/null jeu. janv. 01 00:00:00 1970 +0000
+++ b/RelaxNG/Examples/Metadata/metadatas.xml sam. nov. 16 09:38:44 2013 +0100
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Id$ -->
+<publimeta version="1.0">
+ <metadatas>
+ <!-- ================================================================== -->
+ <metadata for="9782843550362" xml:lang="fr">
+ <title>Torture test</title>
+ <shorttitle>Test</shorttitle>
+ <subtitle>Test des capacités de <name>publidoc</name></subtitle>
+ <subtitle>Représentation exhaustive des structures</subtitle>
+ <identifier type="ean">9781449328030</identifier>
+ <identifier type="ean" for="kf8">9781449328031</identifier>
+ <identifier type="uri">http://www.prismallia.fr/Xml/torture_test</identifier>
+ <copyright>Prismallia, Paris, 2013</copyright>
+ <collection>Sachez vous mettre à l'épreuve</collection>
+ <contributors>
+ <contributor>
+ <firstname>Patrick</firstname><lastname>PIERRE</lastname>
+ <role>author</role>
+ </contributor>
+ <contributor>
+ <firstname>Tien Haï</firstname><lastname>NGUYEN</lastname>
+ <role>illustrator</role>
+ </contributor>
+ <contributor>
+ <label>Prismallia</label>
+ <address>12 rue de la Montagne – 75005 Paris</address>
+ <link uri="http://www.prismallia.fr"/>
+ <role>publisher</role>
+ <role>packager</role>
+ </contributor>
+ </contributors>
+ <date value="2013-01"/>
+ <keywordset>
+ <keyword>publidoc</keyword>
+ <keyword>Cyrano</keyword>
+ <keyword>météo</keyword>
+ </keywordset>
+ <subjectset>
+ <subject>Littérature</subject>
+ <subject>Mathématiques</subject>
+ </subjectset>
+ <abstract>
+ <p>
+ Ce fichier rassemble un maximum de situations afin de tester les
+ possibilités de <name>publidoc</name>.
+ </p>
+ </abstract>
+ <price currency="EUR">13.50</price>
+ </metadata>
+
+ <!-- ================================================================== -->
+ <metadata for="les_miserables" xml:lang="fr">
+ <title>Les Misérables</title>
+ <contributors>
+ <contributor>
+ <firstname>Victor</firstname><lastname>HUGO</lastname>
+ <role>author</role>
+ </contributor>
+ </contributors>
+ <date value="1862"/>
+ <subjectset>
+ <subject>Littérature</subject>
+ </subjectset>
+ <price currency="EUR">19.90</price>
+ </metadata>
+ </metadatas>
+</publimeta>
--- /dev/null jeu. janv. 01 00:00:00 1970 +0000
+++ b/RelaxNG/publimeta.rnc sam. nov. 16 09:38:44 2013 +0100
@@ -0,0 +1,258 @@
+# $Id$
+
+start = publimeta
+
+
+publimeta = element publimeta {
+ publimeta.attributes,
+ publimeta.content
+}
+
+publimeta.attributes =
+ version.attribute
+version.attribute = attribute version { "1.0" }
+
+publimeta.content =
+ metadatas
+
+
+# =============================================================================
+# TOP LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadatas ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+metadatas = element metadatas { metadatas.content }
+
+metadatas.content =
+ metadata+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+metadata = element metadata { metadata.attributes, metadata.content }
+
+metadata.attributes =
+ metadata.for.attribute
+ & lang.attribute?
+metadata.for.attribute = attribute for { xsd:NMTOKEN }
+lang.attribute = attribute xml:lang { xsd:language }
+
+metadata.content =
+ (title, shorttitle?, subtitle*)?
+ & identifier*
+ & copyright*
+ & collection?
+ & contributors?
+ & date?
+ & keywordset?
+ & subjectset?
+ & abstract?
+ & price?
+
+
+# =============================================================================
+# METADATA LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~ title, shorttitle, subtitle ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+title = element title { title.content }
+shorttitle = element shorttitle { title.content }
+subtitle = element subtitle { title.content }
+
+title.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ identifier
+identifier = element identifier {
+ (attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"})
+ | (attribute type { "uri" }, for.attribute?, xsd:anyURI)
+}
+
+for.attribute = attribute for { xsd:NCName }
+
+# ~~~~~~ identifier.ean
+identifier.ean = element identifier {
+ attribute type { "ean" }, for.attribute?, xsd:token {pattern = "\d{13}"}
+}
+
+# ~~~~~~ identifier.uri
+identifier.uri = element identifier {
+ attribute type { "uri" }, for.attribute?, xsd:anyURI
+}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ copyright ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+copyright = element copyright { copyright.content }
+
+copyright.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+collection = element collection { collection.content }
+
+collection.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ contributors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ contributors
+contributors = element contributors { contributors.content }
+
+contributors.content =
+ contributor+
+
+# ~~~~~~ contributor
+contributor = element contributor { contributor.content }
+
+contributor.content =
+ (((firstname, secondname?)?, lastname) | label),
+ address?,
+ link?,
+ role+
+
+# ~~~~~~ firstname, secondname, lastname, label
+firstname = element firstname { firstname.content }
+secondname = element secondname { secondname.content }
+lastname = element lastname { lastname.content }
+label = element label { label.content }
+
+firstname.content = inlines
+secondname.content = inlines
+lastname.content = inlines
+label.content = inlines
+
+# ~~~~~~ address
+address = element address { address.content }
+
+address.content = inlines
+
+# ~~~~~~ role
+role = element role { role.content }
+
+role.content = "author" | "illustrator" | "publisher" | "packager"
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ keyword & subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# ~~~~~~ keywordset
+keywordset = element keywordset { keywordset.content }
+
+keywordset.content = keyword+
+
+# ~~~~~~ keyword
+keyword = element keyword { keyword.content }
+
+keyword.content = mixed { sup*, sub* }
+
+# ~~~~~~ subjectset
+subjectset = element subjectset { subjectset.content }
+
+subjectset.content = subject+
+
+# ~~~~~~ subject
+subject = element subject { subject.content }
+
+subject.content = mixed { sup*, sub* }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ abstract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+abstract = element abstract { abstract.content }
+
+abstract.content =
+ p+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ price ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+price = element price { price.attributes, price.content }
+
+price.attributes =
+ currency.attribute
+currency.attribute = attribute currency { "EUR" | "USD" }
+
+price.content = xsd:float
+
+
+# =============================================================================
+# BLOCK LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+p = element p { p.content }
+
+p.content =
+ inlines
+
+
+# =============================================================================
+# INLINE LEVEL
+# =============================================================================
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+inlines = mixed {
+ sup*
+ & sub*
+ & date*
+ & name*
+ & highlight*
+ & link*
+}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub, sup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+sup = element sup { inlines }
+
+sub = element sub { inlines }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+date = element date { date.attributes, date.content }
+
+date.attributes =
+ date.value.attribute
+date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear }
+
+date.content = mixed { sup* }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+name = element name { name.attributes, name.content }
+
+name.attributes =
+ name.of.attribute?
+name.of.attribute = attribute of {
+ "person" | "company" | "book" | "newspaper" | "party" | "painting"
+ | "movie" }
+
+name.content = mixed { sup* }
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ highlight ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+highlight = element highlight { highlight.content }
+
+highlight.content = inlines
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+link = element link { link.attributes, link.content }
+
+link.attributes =
+ uri.attribute
+uri.attribute = attribute uri { xsd:anyURI }
+
+link.content = mixed { sup* & sub* & date* & name* & highlight* }
+
+
+# =============================================================================
+# REMAP ATTRIBUTES
+# =============================================================================
+
+remap.attributes =
+ as.attribute?
+ & attributes.attribute?
+ & transform.attribute?
+as.attribute = attribute as { xsd:QName }
+attributes.attribute =
+ attribute attributes {list { (xsd:token {pattern = "\c+=\S+"})+ }}
+transform.attribute = attribute transform { xsd:anyURI }