Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Wendell Piez <wapiez@---------------->
To:
Date: 6/1/2000 1:59:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent