xsl-list
[Top] [All Lists]

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

2010-02-03 09:27:21
http://www.w3.org/TR/xslt20/#format-date 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 =
 
"(([^\[\]]|\[\[|\]\])+|\[[YMDdFWwHhPmsfZzCE](((\p{Nd}|\p{Nl}|\p{No}|\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo})+|N|n|Nn)[to]?)?(,([0-9]+|\*)(-[0-9]+|\*)?)?\])+"
 }

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
http://dev.stg.brown.edu/staff/Syd_Bauman/temp/format-dateTime-picture-validate.tgz.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--