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

Comparing two dates [was Re: Please help (XSLT)]

Subject: Comparing two dates [was Re: Please help (XSLT)]
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 01 Jun 2000 12:58:51 +0100
xsl compare two dates
Cheun:

The value of a node set is defined as the value of the first node in the
set, which is why you are getting your result: <xsl:value-of
select="//EXPIRE"/> gives you the value of the first EXPIRE element in the
document.

It looks to me that that since you want the output for <CONDITION> to vary
based on the date you're passing in, its template is where you want to do
your testing -- if your ticket has not expired, put out one value
("valid"), otherwise some other value ("expired"?).

You could do that by using your named template readExp as a function to
establish numerical values for your dates, and then comparing them.

<xsl:template match="CONDITION">
  <xsl:variable name="ticketdate">
    <xsl:call-template name="readExp">
      <xsl:with-param name="expire" select="../FEATURES/EXPIRE">
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="expdate">
    <xsl:call-template name="readExp">
      <xsl:with-param name="expire" select="$expire">
    </xsl:call-template>
  </xsl:variable>

  <!-- here, compare the two variables 
       and create the output that you want (use <xsl:choose>) -->
</xsl:template>

Also, you'll need to insert an <xsl:param> element inside your named
template so you can feed the $expire parameter in from the calling template.

Read up on named templates and parameters to get this. Basically you're
using a named template as a function in XSLT: a very useful technique.

>	At the CONDITION, when I tried this:
>
>	<xsl:value-of select="//EXPIRE"	 />
>
>	It only print out the first TICKET's EXPIRE value which is "2 May 
>2000". Please help me. Even a small hint is much appreciated. Thousand
>thanks.
>
>Best regards,
>Cheun Ngen CHONG


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 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.