[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: can attribute in XML schema hold value and unit
Chiusano Joseph wrote: > Yes, but per my message below, how would you validate using regular > expressions *only* that the date value is not (for example) February 30th? With a regex you could use something like this [1,2,4-9][0-9]?"-"[1-9][0-2]?-"[0-9]{4} | [3] ( [0]"-"[1-9][02]?"-"[0-9] {4}) | ([1]? "-" [1-9][0-2] "-" [0-9]{4} ) In Schematron, you could express the constraint using something like this: <sch:rule context="thing[@date]"> <sch:let name="day" value="substring( @date, 1, 2)" /> <sch:let name="month" value="substring( @date, 3, 2" /> <sch:assert test="not( $month = 2 and $day= 30)"> The date value should not be February 30 </sch:assert> </sch:rule> Cheers Rick Jelliffe
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|