OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] can attribute in XML schema hold value and unit

[ Lists Home | Date Index | Thread Index ]

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS