[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Element validation based on attribute value? XMLSchema +


imperial values

Jeni Tennison wrote:

> <xs:simpleType name="meters">
>   <xs:restriction base="length">
>     <xs:maxInclusive value="3" />
>   </xs:restriction>
> </xs:simpleType>
>
> <xs:simpleType name="feet">
>   <xs:restriction base="length"
>     <xs:maxInclusive value="9.84" />
>   </xs:restriction>
> </xs:simpleType>

This works well enough in the case where you only "want to validate the myElement
is always <= 3 meters (regardless of the unit of measure.....so it's less than
roughly 11 feet)" (which is exactly what Jeni responded to), but in more general
cases, I don't think it would be a great approach.

As fractions of feet aren't typically expressed as a decimal value, either the
user or a process will be relied on to convert 9' 10 5/8" (or whatever it is) to
9.84' and then back, when the user requires a value that they can find on a tape
measure. Further processing is then required to compare the metric and imperial
values. If I were the original poster, I'd be inclined to standardise the uom to
metric and do the conversions as required, even if that meant also storing the
equivalent imperial size to prevent possible rounding errors.

(Although I'm sure that Jeni could do a schema fragment that handled the
interaction of feet, inches, and all of the common fractions down to, say, 64ths,
I'm pretty sure that she won't bother - infact, those sorts of co-occurrence
constraints sound right up Schematron's alley...;-)

Feet and inches. Two good reasons that the civilised world adopted the metric
system.


--
Regards,

Marcus Carr                      email:  mrc@a...
___________________________________________________________________
Allette Systems (Australia)      www:    http://www.allette.com.au
___________________________________________________________________
"Everything should be made as simple as possible, but not simpler."
       - Einstein


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.