W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Defining uniqueness on optional element

From: Cams Ismael <Ismael.Cams@siemens.com>
Date: Thu, 27 Mar 2003 09:53:22 +0100
Message-ID: <57FD2C3A246F76438CA6FDAD8FE9F1957ABC70@hrtades7.atea.be>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT