How can I compare two values?

R

roy_it

During the validation of a xml, with my xsd file, can I compare the
value of two attributes?

Thank U


Nella validazione di un xml, con un file xsd, posso confrontare i
valori di due attributi?

Grazie
 
C

C. M. Sperberg-McQueen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top