Defining uniqueness on optional element

Hello all,

I have an question regarding uniqueness. Consider following xml file:

<node>
     <module name="test1">
	<community>T1</community>
     </module>
     <module name="test1">
	<community>T2</community>
    </module>
</node>

The community element is optional. What I need is to define uniqueness:
	a) for the module names if the community tag is not present
            b) for the combination module name/community if the community
tag is available

What I have now is:

<xsd:unique name="uniqueModule"> (xsd:unique because community tag is
optional)
	<xsd:selector xpath="module"/>
	<xsd:field xpath="community"/>
</xsd:unique>

This covers the second case, but not the first one (when optional tag is not
available this module element is ignored). Because it's not possible to use
tests in these XPath expressions I don't see a solution for my problem. Can
somebody help me with this ?

Thanks in advance.

Kind regards,
Ismaël

Received on Thursday, 27 March 2003 03:53:29 UTC