[relaxng-user] only some xhtml elements inside a text

Giampaolo giampaolo at trapo.it
Tue May 25 23:27:33 ICT 2004


hi to all,

i've a grammar like the one below. I'm using xhtml:body has element and 
including a xhtml-basic grammar found elsewhere. My goal is to have to 
elements where i can put text, links, bold, underlined or italic text. 
Moreover i would like that my body element were never empty. Can someone 
give me a little hint?

the xml where i started from is something like this:

<?xml version="1.0" encoding="UTF-8"?>
<hcilabnews:news xmlns:hcilabnews="http://hcilab.uniud.it/news/1.0" 
xmlns:xhtml="http://www.w3.org/1999/xhtml" >
    <hcilabnews:data>
        <hcilabnews:title>
            <xhtml:body>
        The <xhtml:a href="http://hcilab.uniud.it">Mobile Hci Conference 
2003</xhtml:a> will be held at Udine
            </xhtml:body>
        </hcilabnews:title>
        <hcilabnews:link>http://hcilab.uniud.it/mobilehci</hcilabnews:link>
        <hcilabnews:linkdescription>[more on 
this]</hcilabnews:linkdescription>
        <hcilabnews:description>
            <xhtml:body>
        The HCI Lab announces the fifth edition of the Mobile HCI 
Conference, that will be held in Udine in September 2003. For more 
information, visit the site <xhtml:a 
href="http://hcilab.uniud.it">HciMobile2003</xhtml:a>
            </xhtml:body>
        </hcilabnews:description>
        <hcilabnews:date>2002-09-16</hcilabnews:date>
    </hcilabnews:data>
</hcilabnews:news>



<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:xhtml="http://www.w3.org/1999/xhtml" 
xmlns:hcilabnews="http://hcilab.uniud.it/news/1.0"  
xmlns="http://relaxng.org/ns/structure/1.0" 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
    <start>
        <include href="xhtml/xhtml-basic.rng"/>
            <element name="hcilabnews:data">
                <element name="hcilabnews:title">
                    <element name="xhtml:body">
                        <oneOrMore>
                            <choice>
                                <text/>
                                <element name="xhtml:a">
                                    <attribute name="href">
                                        <data type="anyURI"/>
                                    </attribute>
                                    <data type="NCName"/>
                                </element>
                            </choice>
                        </oneOrMore>
                    </element>
                </element>
                <element name="hcilabnews:link">
                    <data type="anyURI"/>
                </element>
                <element name="hcilabnews:linkdescription">
                    <text/>
                </element>
                <element name="hcilabnews:description">
                    <element name="xhtml:body">
                        <oneOrMore>
                            <choice>
                                <text/>
                                <element name="xhtml:a">
                                    <attribute name="href">
                                        <data type="anyURI"/>
                                    </attribute>
                                    <data type="NCName"/>
                                </element>
                            </choice>
                        </oneOrMore>
                    </element>
                </element>
                <element name="hcilabnews:date">
                    <data type="NMTOKEN"/>
                </element>
            </element>
    </start>
</grammar>


More information about the relaxng-user mailing list