This is a very bizarre XML design, and XSD is not designed to enable validation of bizarre XML designs.
It can of course be done using XSD 1.1 assertions: something like
<xs:assert test="every $a in $value/@* satisfies name($a) = 'id' or name($a) = 'link1' or
(matches(name($a), 'link[0-9]+' and exists($value/@*[name() = concat('link', number(substring-after(name($a), 'link'))-1)))"/>
Michael Kay
Saxonica
Hi!
I need to validate the following xml structure:
...
<element id="1" link1="xyz" link2="xyzz" />
...
There can be from link1 attr to anyone desired.
How could I achieve that using XSD?
Best regards!
/Pedro