Hi,
From TSD4.2 (Tamino Version 4.2) there is the logical schema property “tsd:unique”. You can specify, at the doctype level, which elements/attributes must be unique per xml instance. You can set the tsd:unique property in the Schema Editor by selecting the doctype node and clicking “Insert, TSD Unique”. You must then set the field XPaths of the elements/attributes that comprise the unique “key”.
There’s more in the documentation under Tamino XML Schema Reference Guide/Tamino Extensions…/tsd:unique.
HTH
Aaah, I’m testing it with the XML StarterKit (=Tamino 4.1.4.1). That’s why i couldn’t find it.
Well that brings me to another problem. Because now i’ll have to check the id attributes myself.
I would like to get the highest id attribute from a lexon.
I’ve tried the max() function as well in XQuery as in X-Query but I always the a NaN result. The count() function, however, does return a valid result.
max(//lexon[@id])
I also think I know why that is:
count() requires a node sequence
while
max() requires a sequence of items
So now is my question:
How could i retrieve the highest lexon id value (as example shown in my previous post) ?
Bill’s proposal is unfortunately only partly correct as tsd:unique
(which is supported since Tamino 4.2)
is a constraint across all documents in a doctype
allows only for cardinality 1 of referenced nodes
In XSD, the identity constraints (xsd:unique, xsd:key) will allow for the constraint you need applying to multiple occurences of a logical node within a single document.
Unfortunately, this is not yet supported by Tamino 4.2, but - at least some good news - Tamino 4.4 will support that feature!