XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
How to Unique contraint

Hi,

I am trying to use a unique contraint <xsd:unique> in my xsd file that covers  
several attributes.

example:

<root>
	<anElement port="123" debug-port="234"/>
	<anElement port="125" debug-port="678"/>
</root>

here the constraint is that no port or debug-port can have the same number.

I can do them individually in the XSD like this

<xs:unique name="port">
	<xs:selector xpath="anElement"/>
	<xs:field xpath="@port"/>
</xs:unique>
<xs:unique name="debug-port">
	<xs:selector xpath="anElement"/>
	<xs:field xpath="@debug-port"/>
</xs:unique>

But this only means that the port attributes cannot contain the same value and 
the debug-port attribute cannot contain the same value.

What I want is that no port or debug-port can have the same value. BTW debug-
port is an optional attribute.

Does anybody know how to do this so it looks something like the following 
INVALID constraint, but I hope you get the picture.

<xs:unique name="port">
	<xs:selector xpath="anElement"/>
	<xs:field xpath="@debug-port | @port"/>
</xs:unique>

or maybe somebody can tell me how to get all attributes with the value 'port' 
in their name (not in thier content) i.e. so that it matches both @port and 
@debug-port. Something like the following (which does not work either):

<xs:unique name="port">
	<xs:selector xpath="anElement"/>
	<xs:field xpath="@*[contains('port`)]"/>
</xs:unique>

And if <xsd:unique> requires to match only a single or empty node-list response 
and it canīt do what I want, can anybody help with an alternative approach or 
solution???


Regards

Steve





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS