Re: [xsl] Working with xs:date and xs:gYearMonth

Subject: Re: [xsl] Working with xs:date and xs:gYearMonth
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 25 Jun 2004 00:15:25 +0100
>>>>> "Michael" == Michael Kay <mhk@xxxxxxxxx> writes:

    >> Well, rather than use a baseline at all, since I am only
    >> interested in the previous and following months in the 21st
    >> century for my application, I came up with the following safe
    >> (if somewhat verbose) solution:

    Michael> Some comments inline:
    >> 
    >> 
    >> <xsl:variable name="today" select="current-date ()"
    >> as="xs:date"/> <xsl:param name="date" select="$today"
    >> as="xs:date"/>

    Michael> Why two variables with the same value? You could just
    Michael> declare the param, and give it a default value of
    Michael> current-date().

I need the today variable for other purposes elsewhere in the
stylesheet.


    Michael> Your coding style of doing the work with a sequence of
    Michael> local variables inside an outer xsl:variable is
    Michael> interesting. I wouldn't have thought of doing it this
    Michael> way, but I can't fault it.

I did it that way just so I could be absolutely clear in my mind what I was
doing.
But I think I'll take on board your suggestions, as the stylesheet
will be much shorter then.

Thanks.
-- 
Colin Paul Adams
Preston Lancashire

Current Thread