[Home] [By Thread] [By Date] [Recent Entries]


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


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member