Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How can I compare two values? [Thread Next] Re: How can I compare two values?To: NULL Date: 7/8/2005 11:47:00 AM "roy_it" <roy_it@k...> 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
