Re: [xsl] dateTime format string, Anyone developed an rng definition?

Subject: Re: [xsl] dateTime format string, Anyone developed an rng definition?
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Wed, 03 Feb 2010 16:47:26 +0000
On 03/02/10 15:26, Syd Bauman wrote: defines
   format-dateTime( $value    as xs:dateTime?,
                    $picture  as xs:string,
		     $language as xs:string?,
		     $calendar as xs:string?,
		     $country  as xs:string?) as xs:string?
The picture string is fairly regular.
Has anyone produced a relaxng expression which captures it please?

I hadn't, but just took a crack at it. I think

  xsd:token { pattern =

does the job, (Note xsd:token, not xsd:string, as I wrote this
presuming the string to be matched has already been run through
normalize-space().) Not very well tested. See

I took note from John Cowan that comments can be used Syd!
I'm ignoring certain values (simplicity).

So far I've generated

<element name='doc'>
<element name='dateTime'>
  <data type='string'>
Year -->(\[Y(01|0001)?\][^\[]?)<!--
Month -->(\[M(1|01)?\]?[^\[]?)<!--
Day -->(\[D(1|01)?\])?<!--
Hour -->(T\[H[01]{0,2}\]:<!--
Minutes -->\[m(1|01)?\]:<!--
Seconds         -->\[s(1|01)?\]\.<!--
decimal seconds -->\[f(1|01|001)?\])?</param>

with test data of


<!-- Errors -->


and exclusions of

   YWw for 'Two thousand and ten'
    MNn   for December
    Dlo   for 31st
    DWo   for twentieth

Its for a graph X axis, using dates.
As you see, we only need the Y M D H m s parts
which makes it a little easier.

I thought someone may have done it already

Thanks though. Appreciated.


Dave Pawson

Current Thread