[relaxng-user] including XLink attributes in RNG schema question
Helka Folch
hfolch at free.fr
Sun Jul 11 23:42:19 ICT 2004
Hello,
I'm trying to write a Relax-ng schema to describe elements which have
xlink href attributes attached to them. For instance, I want the schema
to describe the following :
<node xmlns:xlink="http://www.w3.org/1999/xlink" >
<use xlink:href="http://wwwhatever"/>
</node>
So, in my schema I include the RNG schema for XLink (xlink.rng) and the
reference to Xlink attributes :
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<include href="xlink.rng"/>
<start>
<element name="node" >
<element name="use">
<empty/>
<ref name="XLINK.simple.attlist"/>
</element >
</element >
</start>
</grammar>
If I understand correctly, there are no default or fixed values for
attribute definitions in RNG schemas. Does that mean that the required
XLink attribute 'type' has to be specified on each element of the
instance document that also uses the XLink attribute href, for it to be
valid?, like this :
<use xlink:href="http://wwwhatever" xlink:type="simple" />
My second question, concerns the fact that I would like the 'href'
attribute to be a required attribute of the 'use' element. However, in
the RNG schema for XLink the href attribute (XLINK.href.attrib) is
defined as optional, so when I include the definition in my schema I
import the optionality.
Is there another way of including XLink attributes that wouldn't require
specifying the xlink 'type' attribute in the instance document and
would allow me to define the xlink href attribute as required in the
schema, while conforming to the XLink spec?
Many thanks,
Helka Folch
More information about the relaxng-user
mailing list