468,727 Members | 1,472 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,727 developers. It's quick & easy.

How can I compare two values?

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

Jul 20 '05 #1
1 1286
"roy_it" <ro****@katamail.com> writes:
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

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Russ Green | last post: by
7 posts views Thread by Prabhudhas Peter | last post: by
reply views Thread by Nikolay Petrov | last post: by
10 posts views Thread by Y2K | last post: by
3 posts views Thread by mcolson | last post: by
3 posts views Thread by =?Utf-8?B?UmljY2FyZG8=?= | last post: by
26 posts views Thread by neha_chhatre | last post: by
5 posts views Thread by =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post: by
9 posts views Thread by bryonone | last post: by
xarzu
1 post views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.