# HG changeset patch # User Patrick PIERRE <patrick.pierre@prismallia.fr> # Date 1311009028 -7200 # Node ID c70de8fae29df29adc9cf2d643126a4523e27e77 # Parent 057abb684d359935c7183d8a9b95a4513482037f Ajout d'un role pour les auteurs diff -r 057abb684d35 -r c70de8fae29d RelaxNG/publidoc.rnc --- a/RelaxNG/publidoc.rnc lun. juin 20 18:39:46 2011 +0200 +++ b/RelaxNG/publidoc.rnc lun. juil. 18 19:10:28 2011 +0200 @@ -105,9 +105,20 @@ # ~~~~~~ author author = element author { author.content } +author.attributes = + role.attribute? +role.attribute = attribute role { "author" | "illustrator" } + author.content = firstname?, - lastname + lastname, + role* + +role = element role { role.attributes } + +role.attributes = + role.of.attribute +role.of.attribute = attribute of { "author" | "illustrator" } # ~~~~~~ publisher publisher = element publisher { publisher.content } @@ -155,8 +166,7 @@ pagenumber.attributes = pagenumber.value.attribute -pagenumber.value.attribute = attribute value { pagenumber.value.enumeration } -pagenumber.value.enumeration = xsd:positiveInteger +pagenumber.value.attribute = attribute value { xsd:positiveInteger } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -443,8 +453,7 @@ date.value.attribute & date.of.attribute? date.value.attribute = attribute value { xsd:date | xsd:gYearMonth | xsd:gYear } -date.of.attribute = attribute of { date.of.enumeration } -date.of.enumeration = "birth" | "death" +date.of.attribute = attribute of { "birth" | "death" } date.content = mixed { sup* } @@ -454,8 +463,8 @@ name.attributes = name.of.attribute? -name.of.attribute = attribute of { name.of.enumeration } -name.of.enumeration = "person" | "company" | "book" | "newspaper" | "party" +name.of.attribute = attribute of + { "person" | "company" | "book" | "newspaper" | "party" } name.content = inlines diff -r 057abb684d35 -r c70de8fae29d RelaxNG/publidoc.rng --- a/RelaxNG/publidoc.rng lun. juin 20 18:39:46 2011 +0200 +++ b/RelaxNG/publidoc.rng lun. juil. 18 19:10:28 2011 +0200 @@ -252,11 +252,43 @@ <ref name="author.content"/> </element> </define> + <define name="author.attributes"> + <optional> + <ref name="role.attribute"/> + </optional> + </define> + <define name="role.attribute"> + <attribute name="role"> + <choice> + <value>author</value> + <value>illustrator</value> + </choice> + </attribute> + </define> <define name="author.content"> <optional> <ref name="firstname"/> </optional> <ref name="lastname"/> + <zeroOrMore> + <ref name="role"/> + </zeroOrMore> + </define> + <define name="role"> + <element name="role"> + <ref name="role.attributes"/> + </element> + </define> + <define name="role.attributes"> + <ref name="role.of.attribute"/> + </define> + <define name="role.of.attribute"> + <attribute name="of"> + <choice> + <value>author</value> + <value>illustrator</value> + </choice> + </attribute> </define> <!-- ~~~~~~ publisher --> <define name="publisher"> @@ -343,12 +375,9 @@ </define> <define name="pagenumber.value.attribute"> <attribute name="value"> - <ref name="pagenumber.value.enumeration"/> + <data type="positiveInteger"/> </attribute> </define> - <define name="pagenumber.value.enumeration"> - <data type="positiveInteger"/> - </define> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- ~~~~~~ subjectset --> <define name="subjectset"> @@ -971,15 +1000,12 @@ </define> <define name="date.of.attribute"> <attribute name="of"> - <ref name="date.of.enumeration"/> + <choice> + <value>birth</value> + <value>death</value> + </choice> </attribute> </define> - <define name="date.of.enumeration"> - <choice> - <value>birth</value> - <value>death</value> - </choice> - </define> <define name="date.content"> <mixed> <zeroOrMore> @@ -1001,18 +1027,15 @@ </define> <define name="name.of.attribute"> <attribute name="of"> - <ref name="name.of.enumeration"/> + <choice> + <value>person</value> + <value>company</value> + <value>book</value> + <value>newspaper</value> + <value>party</value> + </choice> </attribute> </define> - <define name="name.of.enumeration"> - <choice> - <value>person</value> - <value>company</value> - <value>book</value> - <value>newspaper</value> - <value>party</value> - </choice> - </define> <define name="name.content"> <ref name="inlines"/> </define> diff -r 057abb684d35 -r c70de8fae29d Xml/Documents/torture_test.xml --- a/Xml/Documents/torture_test.xml lun. juin 20 18:39:46 2011 +0200 +++ b/Xml/Documents/torture_test.xml lun. juil. 18 19:10:28 2011 +0200 @@ -8,6 +8,10 @@ <author> <firstname>Patrick</firstname><lastname>PIERRE</lastname> </author> + <author> + <firstname>Tien Haï</firstname><lastname>NGUYEN</lastname> + <role of="illustrator"/> + </author> <publisher>Prismallia</publisher> <language xml:lang="fr"/> <date value="2001-06"/>