roy_it said:
During the validation of a xml, with my xsd file, can I
compare the value of two attributes?
Nella validazione di un xml, con un file xsd, posso
confrontare i valori di due attributi?
I'm not sure I understand the question.
If you mean "Can I write a schema using XML Schema 1.0 in
which the value of attribute x is valid if and only if it is
less than the value of attribute y?" (or equal to, or less
than the square of, or ...) the answer is no, unless you can
think of some clever approach I haven't thought of.
Such instance-based constraints, where the value (or presence
or absence) of one attribute (or element) determines the
limits to be imposed on some other attribute (or element), are
not supported by XML Schema 1.0. (They are analogous to
row-level CHECK clauses in SQL and the WG felt it was best to
wait until there was a standard query language in which to
express them. We could have allowed predicates using the
definition in XPath 1.0, but we thought it would be better to
wait for XQuery 1.0 and XPath 2.0.)
You can impose such constraints using Schematron, I believe,
and some such constraints can also be expressed in RelaxNG.
There have been proposals to add them to XML Schema 1.1, or to
define something that can be layered on top of XML Schema 1.1,
but whether those proposals will lead anywhere remains an open
question.
-C. M. Sperberg-McQueen
World Wide Web Consortium