| Subject: Working with xs:date and xs:gYearMonth From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> Date: 22 Jun 2004 20:05:44 +0100 | 
I'm trying to write a transform for generating calendards from some 
xml event data.
I shall want to highlight the entry for today (if the calendar happens
to be displaying the current month), so I set up a global variable
named today:
   <xsl:variable name="today" select="current-date()"  as="xs:date"/>
   
I also want to be able to pass a parameter to name the month to
display, defaulting to the current month, so:
     <xsl:param name="date" select="xs:gYearMonth($today)"  as="xs:gYearMonth"/>
As I want to generate a hyperlink to the previous month, I want a
variable that I can put into the query string of a URL so:
     <xsl:variable name="previous_month"
        select="xs:gYearMonth(xs:date($date) -
        xdt:yearMonthDuration('P0Y1M'))" as="xs:gYearMonth"/>
But when I try to reference this variable:
<th id="lastmonth"><a href="/onevoice/members/calendar?date='{$previous_month}'">«</a></th>
saxon (8.0b) gives me:
Error at attribute on line 60 of file:/home/colin/onevoice/members/calendar.xsl:
  Cannot convert gYearMonth to xs:date
Transformation failed: Run-time errors were reported
How am I supposed to go about this?
-- 
Colin Paul Adams
Preston Lancashire
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Converting HTML to plain , Max Romantschuk | Thread | RE: [xsl] Working with xs:date and , Michael Kay | 
| Re: [xsl] conversion from xslt2.0 t, J.Pietschmann | Date | RE: [xsl] List of Unique Items with, Michael Kay | 
| Month |