[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Working with xs:date and xs:gYearMonth

Subject: Working with xs:date and xs:gYearMonth
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 22 Jun 2004 20:05:44 +0100
gyearmonth
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}'">&#171;</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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.