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

Calling exslt date function

Subject: Calling exslt date function
From: "Tom Froehlich" <Tom@xxxxxxxxx>
Date: Tue, 12 Aug 2003 16:33:33 -0700
xsl date functions
Well,

I got a plain xml file of events that needs to be transformed to html
via an xsl stylesheet. The transformation should only include events
with a begin date equal to or greater than the current date (system
date), all past events in the xml file are ignored. We upload a fresh
xml file once per month or so.

Our server runs msxml4 and I got the exslt date functions installed.
Somehow, I cannot figure how to get the dynamic, current date to work in
my stylesheet. I get no error message, just no events and no current
date value.... It works fine when I use the enterdate variable instead.

The xml:
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata">
<tblCurrentEvents>
<EventID>1</EventID>
<EventName>The Financial Cruncher Demo</EventName>
<EventDescription>Two hour demo of the new features in FC
4.2.</EventDescription>
<EventType>Demo</EventType>
<EventAudience>For current users of FC only.</EventAudience>
<EventBeginDate>2003-06-04T00:00:00</EventBeginDate>
<EventEndDate>2003-06-04T00:00:00</EventEndDate>
<EventBeginTime>09:30 AM</EventBeginTime>
<EventEndTime>11:30 AM</EventEndTime>
<FeeStatus>FREE</FeeStatus>
<Fee>0</Fee>
<Discount>10% for each additional attendee per organization.</Discount>
<EventLocation>San Francisco Training Center</EventLocation>
<EventStatus>open</EventStatus>
<EventSchedule>recurring-monthly</EventSchedule>
<EventRegistration>Event registration required.</EventRegistration>
</tblCurrentEvents>
<tblCurrentEvents>
.
.
.

The xsl:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:date="http://exslt.org/dates-and-times"	
    extension-element-prefixes="date">
    <xsl:import href="functions\date\date.date.template.xsl" />
    
    <xsl:variable name="enterdate" select="'2003-08-01T00:00:00Z'"/>
<!-- just in case -->
    
    <xsl:variable name="currentdate">
      <xsl:call-template name="date:date">
      <xsl:with-param name="date-time" select="." />
      </xsl:call-template>
    </xsl:variable>
    
    <xsl:template match="/">
        <xsl:for-each select="//tblCurrentEvents">
            <xsl:variable name="begindate" select="EventBeginDate" />
            <xsl:variable name="showdateBegin" select="EventBeginDate"/>
            <xsl:variable name="showdateEnd" select="EventEndDate"/>
            <xsl:variable name="YearBegin"
select="substring-before($showdateBegin, '-')" />
            <xsl:variable name="MonthBegin"
select="substring($showdateBegin, 6, 2)" />
            <xsl:variable name="DayBegin"
select="substring($showdateBegin, 9, 2)" />
            <xsl:variable name="YearEnd"
select="substring-before($showdateEnd, '-')" />
            <xsl:variable name="MonthEnd"
select="substring($showdateEnd, 6, 2)" />
            <xsl:variable name="DayEnd" select="substring($showdateEnd,
9, 2)" />
            <xsl:choose>
            <xsl:when test="translate(substring-before($begindate, 'T'),
'-', '') &gt;= translate(substring-before($currentdate, 'T'), '-', '')">
                <p align="left" class="body">
                    <div align="left">
                        <table border="0" cellpadding="0"
style="border-collapse: collapse" width="440" cellspacing="2">
                            <tr>
                                <td width="10%" valign="top">Title:</td>
                                <td width="60%"
valign="top"><b><xsl:value-of select="EventName"/></b></td>
                                <td width="15%"
valign="top"><xsl:text>Event ID: </xsl:text></td>
                                <td width="15%"
valign="top"><xsl:value-of select="EventID"/></td>
                            </tr>
                            <tr>
                                <td valign="top">Date(s):</td>
                                <td colspan="3"
valign="top"><xsl:value-of
select="$MonthBegin"/><xsl:text>/</xsl:text><xsl:value-of
select="$DayBegin"/><xsl:text>/</xsl:text><xsl:value-of
select="$YearBegin"/><xsl:text> to </xsl:text><xsl:value-of
select="$MonthEnd"/><xsl:text>/</xsl:text><xsl:value-of
select="$DayEnd"/><xsl:text>/</xsl:text><xsl:value-of
select="$YearEnd"/></td>
                            </tr>
.
.
.

I'll be happy to make a small donation to your favorite charity... 


Regards,

Tom

**************************************************************
Tom Froehlich, CFRE
Fundraising Consultant
Armanino McKenna LLP
(925) 790-2600
tom@xxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.