DaveP SGML old hands may remember the ability to specify the content of an element as being one from a list of elements, except for this that or the other element. This used to look something like
<!ELEMENT Footnote - O (#PCDATA|Para+) -(Footnote) -- no footnotes in footnotes -->
Which meant that a Footnote could contain PCDATA, Para elements, but could not contain other footnote elements. RelaxNG has a similar idea using the following syntax.
<define name="general">
<element>
<anyName>
<except>
<nsName ns="http://www.dpawson.co.uk/rss/ns#"/>
<nsName/>
</except>
</anyName>
<ref name="anything"/>
</element>
</define>
<define name="anything">
<zeroOrMore>
<choice>
<element>
<anyName/>
<ref name="anything"/>
</element>
<attribute>
<anyName/>
</attribute>
<text/>
</choice>
</zeroOrMore>
</define>
The <except> element used here has a few effects. It disallows anything from the default namespace, it disallows anything from the given namespace (.../rss/ns#) but it will allow elements from the ../rs/ns# namespace if the element has another namespace. For instance the following is valid.
<html xmlns ="http://www.xhtml">
<head><title> xxx </title> </head>
<body>
<h2>Header </h2>
<x xmlns="">
</x>
</body>
</html>
but if any element in the ../rss/ns# namespace is present outside of the <html> element, it will be identified as invalid |