[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: datatype functionality I'd like to see


jscript date format

> This was one of the features of the datatype library language that I
> have been working on [1]. 
hmm, yeah I remember seeing this before but forgot about it.

I think I might have described what I thought about badly, probably from
focusing on the SSN which really had not importance to me other than as an
example.

Let's suppose we have a number of different ways of writing a date, for example
we want a content author just to be able to write <date>January 15, 2003</date>
because for us the most important thing is the ability to data mine information
later, but we would also like to be able to have structures with more specific
date description, like
<USDate><month>12</month><day>03</day><year>1998</year></USDate>
or 
<DanishDate><day>23</day><month>11</month><year>1999</year></DanishDate>

obviously we can go ahead and write validation for each structure, but some
things such as that they are handling an underlying date format should be
maintained. 

Using extensions, which I think this could be done via an exslt extension
actually, then I made something like this:

<sch:dtypes>
<sch:type name="commonDate" using="jscript:Date"/>
</sch:dtypes>

this is bad because it's not cross-processor, then again I can do javascript
extensions in xalan using bsf and I'm sure it's simple enough in the other java
based processors, that's a big part of the market. 

Then my sort of sloppy schematron rules:


<sch:rule context="date">
<sch:assert test="text() | *">date needs to have content</sch:assert>
<sch:assert-datatype type="commonDate" text-seperator="-">a date element needs
to return true against the commonDate datatype</sch:assert-datatype>
   </sch:rule>

   <sch:rule context="USDate">

<sch:assert test="*[1][local-name()='month'] and *[2][local-name()='day'] and
*[3][local-name()='year']">A US Date needs to have a list of
month,day,year</sch:assert>
<sch:assert-datatype type="commonDate" text-seperator="-">a USDate element
needs
to return true against the commonDate datatype</sch:assert-datatype>
   </sch:rule>

<sch:rule context="DanishDate">
<sch:assert test="*[1][local-name()='day'] and *[2][local-name()='month'] and
*[3][local-name()='year']">A Danish Date needs to have a list of
day,month,year</sch:assert>
<sch:assert-datatype type="commonDate" text-seperator="-">a DanishDate element
needs to return true against the commonDate datatype</sch:assert-datatype>
</sch:rule>

so the following 'dates' all validate:

<date>January 03, 1997</date>
<date>01-13-1974</date>
<date><birthday>01-12</birthday><year>2001</year></date>
<USDate><month>12</month><day>03</day><year>1998</year></USDate>
<USDate><month>11</month><day>03</day><year>1998</year></USDate>
<DanishDate><day>23</day><month>11</month><year>1999</year></DanishDate>

but this does not
<date>Heptoary 12, 288</date>

So I suppose other datatype libraries could be built up, a using xsd:date or
something for example. 



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.