[Home] [By Thread] [By Date] [Recent Entries]
Charles,
Mike will probably have the definitive answer on this one. Given how it's now late on Friday over in the UK, however, I'll take a guess. How about having a wrapper function that will accept any argument or none, and does type-checking on it before calling your actual formatting function? XPath 2.0 has the "castable as" operator to help with this kind of thing. In a simple case, you could declare your function's argument (parameter) as "xs:string?" or "element(date)?" or whatever, to allow for a missing argument, and then trap that condition. In my XSLT 2.0 dates processing (which like yours, doesn't assume schema-validity) I have a function that assigns a date of Jan 1, year 1 to things that aren't properly dated (which means "things my code can't make a date out of"). It's something of a kludge, since I have to assume I'll never need the date 0001-01-01 for real. (It's a timesheet application, so this is not unfair.) Later in the application such undated dates get caught, so as not to be treated like my "real" dates. I'd love to know from an actual programmer how better to do this in XSLT. Cheers, Wendell At 04:02 PM 6/2/2006, you wrote: I've written an XSLT function to format dates fetched from a database. This worked well until I pulled some records with NULL values for the date I wished to format. When my stylesheet encountered this element, Saxon emitted this error message and ended with a fatal error:
|

Cart



