kind of mixed (and ordered) content

Matthieu Ricaud-Dussarget <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Organization IGS-CP
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.