xsl-list
[Top] [All Lists]

Re: date formatting function

2004-09-21 05:00:24

On Sep 21, 2004, at 4:48 AM, Michael Kay wrote:

You seem to be asking how to divide the code you need to write between two templates/functions, when both options you present are perfectly viable.

I guess I wanted to know if I was headed down the right road, and you seem to be saying "maybe."

I guess my question, given what I want to do, is how should I construct the function; as a single function -- let's call it bib:format-month-day -- that when called takes any YYYY/YYYY-MM/YYYY-MM-DD string and returns the formatted date (with parameter for whether months are rendered as full or abbreviated)?

That's where I was headed. But if that's sensible, I'm not sure how to actually code it; .e.g. what goes inside the "when" below:

     <xsl:when test="$date castable as xs:gYearMonth">
       ...
     </xsl:when>

Or, more specifically, how do I take the statement "xs:date(concat($date, '-01'))" and then use format-date on it?

Bruce



<Prev in Thread] Current Thread [Next in Thread>