|
[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
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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








