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
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