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

Re: variable date values...

Subject: Re: variable date values...
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Tue, 20 Jun 2006 18:52:58 -0500
xsl when test variable
Hi, Bob,

The big choose block gives you the month string (June, etc.), and the next
statement (<xsl:value-of select="$month"/>) gives the value of the $month
variable, which you have set up to contain the numeric value of the month
(06, etc.). So, you are getting both.

In other words, you're using the $month variable twice (in the choose block
and by itself) when you should use it once (just in the choose block).

Try removing the following line:
<xsl:value-of select="$month"/>

HTH

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Robert Wilkins" <wilkins.robert@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, June 20, 2006 6:15 PM
Subject:  variable date values...


> I'm retrieving a time stamp from the web and extracting the month and
> year values.  I want to replace the numeric month value (06) with a
> month string (JUNE).  Things work OK up to a point - when I use the
> following code to get the string value, the result  reads JUNE06
> rather than just plain old JUNE. It looks as if, the string val is
> concatenated to the numeric month val. Somebody's book told me that
> this was the
> way to go, but it look like I went up the wrong path.
>
> This is part of a larger xml to fo style sheet.  I'm using Saxon
> 6.5.5. This shouldn't be a problem, but I'm doing something wrong.
>
>
> <xsl:variable name="date" select="document('http://xobjex.com/cgi-bin/
> date.pl')/date"/>
>                   <xsl:text>LAST REVISED: </xsl:text>
>                   <xsl:variable name="month" select="$date/utc/month"/>
>                                  <xsl:choose>
>                       <xsl:when test="$month = 01">January</xsl:when>
>                       <xsl:when test="$month = 02">February</xsl:when>
>                       <xsl:when test="$month = 03">March</xsl:when>
>                       <xsl:when test="$month = 04">April</xsl:when>
>                       <xsl:when test="$month = 05">May</xsl:when>
>                       <xsl:when test="$month = 06">June</xsl:when>
>                       <xsl:when test="$month = 07">July</xsl:when>
>                       <xsl:when test="$month = 08">August</xsl:when>
>                       <xsl:when test="$month = 09">September</xsl:when>
>                       <xsl:when test="$month = 10">October</xsl:when>
>                       <xsl:when test="$month = 11">November</xsl:when>
>                       <xsl:when test="$month = 12">December</xsl:when>
>                       <xsl:otherwise>INVALID MONTH</xsl:otherwise>
>                       </xsl:choose>
>
>                   <xsl:value-of select="$month"/>
>                   <xsl:text>/</xsl:text>
>                   <xsl:value-of select="$date/utc/year"/>
>
>
> Thanks in advance....
>
>
> ------ bob wilkins -----

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-2011 All Rights Reserved.