[xsl] Probably a very simple xsl:if question

Subject: [xsl] Probably a very simple xsl:if question
From: Jeroen Ruigrok/asmodai <asmodai@xxxxxx>
Date: Sat, 14 Feb 2004 10:12:09 +0100

I am trying to get an evaluation working with <xsl:if> which I think
should work, but obviously I am missing something very specific, which I
haven't been able to find in any of my books (Learning XSLT not XSLT and
XPath On The Edge) nor on the Internet.

So I appeal to you lot. :)

I got a simple xml file of the form:

    <content>It is Valentine's Day today</content>

Now, in my .xsl file I do the following (don't mind the HTML4, need to convert
it to XHTML still, I also left out the CSS):

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  extension-element-prefixes="date exsl">

  <xsl:output method="html" indent="yes"/>
  <xsl:output doctype-public="-//W3C//DTD HTML 4.01//EN"

  <xsl:template match="news">
    <exsl:document href="news.html">
      <xsl:variable name="now" select="date:date-time()"/>
      <html dir="ltr" lang="en">

	  <h1>News - <xsl:value-of select="date:year($now)"/></h1>

	  <p>News - <xsl:value-of select="date:year($now)"/></p>

	  <xsl:for-each select="entry">
	    <xsl:sort data-type="date" order="descending" select="date"/>
	    <xsl:variable name="
	    <xsl:if test="date:year(date) = $now">
	      <b><xsl:value-of select="date"/></b>: <xsl:value-of select="content"/>

In the <xsl:if test=""> case what I have now yields 0 (xsltproc) whereas
if I replace $now with 2004 it works.  What obvious little thing am I
missing/forgetting here?


Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
PGP fingerprint: 2D92 980E 45FE 2C28 9DB7  9D88 97E6 839B 2EAC 625B
http://www.tendra.org/   | http://diary.in-nomine.org/
Every person takes the limits for their own field of vision for the
limits of the world...

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

Current Thread