>Why is the xsd:date type is so restrictive?
I think the answer to this lies in the theory that XML should represent information in a way that's independent of presentation considerations. The XML Schema designers deliberately chose to force you to use a culturally-neutral format.
>The most common date formats used are mm-dd-yyyy
Really? I only know of one country in the world that uses that format.
>and the UK version is dd-mm-yyyy.
dd/mm/yyyy is more common in the UK, but most published documents are likely to write the month as a name.
>I want to create a custom format like dd/mm/yyyy in my schema so that >I can validate some dates. I have posted my attempt below.
It's easy enough to define a pattern such as \d{2}/\d{2}/\d{4}, but there's no way of rejecting 31/02/2004, or even 33/19/2004.
Has anyone successfully achieved this before?
>Is it possible to assign two data types to an element? e.g. If my >dates were to be in "dd/mm/yyyy" or "dd mmm yyyy" formats i'd still >like it to pass the schema validation.
Yes, you can do this with union types. Or (IIRC) you can define more than one pattern.
Michael Kay
http://saxon.sf.net/