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

User-defined datatypes in XSLT 2.0 (Was: Re: re

Subject: User-defined datatypes in XSLT 2.0 (Was: Re: regexs, grouping (?) and XSLT2?)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 16:59:48 +0100
xsl user defined data type
Hi Mike,

> I think it is worthwhile treating your "union of YYYY-MM-DD,
> YYYY-MM, or YYYY" as a user-defined data type (say m:date), and
> defining your own function library to manipulate this type. For
> example, you can define functions like m:get-year($p as m:date) to
> extract the year, m:make-date($s as xs:string) to construct an
> instance of this type, m:compare() to compare two instances, and so
> on.

Right: interestingly, this is precisely the approach that I'm taking
when incorporating datatypes created with the datatype library
language (old version at http://www.jenitennison.com/datatypes; new
version coming soon) into XSLT 2.0. The values of these user-defined
datatypes, which get passed around between functions, are actually
elements with a string value and a type annotation and various other
things. I have a dt:compare() function that does datatype-aware
comparisons and dt:eq(), dt:lt() etc. functions that call it and have
to be used instead of the 'eq', 'lt' etc. operators. It's all pretty
horrible, and I haven't even thought about how to do datatype-aware
sorting.

Another approach would be to create a Java class that represents the
datatype and somehow hook this into Saxon; I'm not sure that it's all
that easy, however. Any pointers, Mike?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread

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
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.