W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2010

kind of mixed (and ordered) content

From: Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr>
Date: Mon, 02 Aug 2010 16:27:53 +0200
Message-ID: <4C56D5E9.9040307@igs-cp.fr>
To: xmlschema-dev@w3.org
Hello,

I'm trying to modelize a specific constraint with Relax NG which seems 
not to be allowed.

** The constraint **
is a restriction on xhtml elements. I need to say : "this span contain a 
serie of links separated by a coma and a space"
that is :
<span class="foo">
<a href="#1">1</a>,&#160;
<a href="#2">2</a>,&#160;
<a href="#3">2</a>,&#160;
</span>
(well it would be even better if the last <a> has no text after but let 
say I don't care about that)

** It seems not to be allowed **
The specs[1] says :

If the children of an element or an attribute match a data pattern, then 
complete content of the element or attribute must match that data 
pattern. It is not permitted to have a pattern which allows part of the 
content to match a data pattern, and another part to match another 
pattern. For example, the following pattern is /not/ allowed:

<element name="bad">
   <data type="int"/>
   <element name="note">
     <text/>
   </element>
</element>

** My schema **
looks like that :

<rng:oneOrMore>
<rng:group>
<rng:element name="a">
<rng:attribute name="href">
<rng:data type="string">
<rng:param name="pattern">#chap(\d)+_sect(\d)+</rng:param>
</rng:data>
</rng:attribute>
<rng:data type="string"> <!-- no problem here -->
<rng:param name="pattern">\d+</rng:param>
</rng:data>
</rng:element>
<rng:data type="string"> <!-- problem here -->
<rng:param name="pattern">,&#160;</rng:param>
</rng:data>
<!--no problem if I write <rng:text/> instead of the above <rng:data>, 
but than no constraint is possible-->
</rng:group>
</rng:oneOrMore>

** Question **

Can someone tell me more about why this is not allowed ?
Has someone a solution to do it another way ?

Thanks

Matthieu

[1] http://www.oasis-open.org/committees/relax-ng/tutorial.html#IDA5UYR



-- 
Matthieu Ricaud
IGS-CP
Service Livre numérique
Received on Monday, 2 August 2010 15:27:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:57 UTC