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

Re: splitting the date field in xml

Subject: Re: splitting the date field in xml
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Feb 2001 09:36:07 +0000
splitting the date string
Hi Jim,

The substring() stuff will work fine, but you might find it easier to
use substring-before() and substring-after() to deal with the fact the
dates might change length - even if they change length, they'll still
be space-separated.  So instead of:

> <xsl:choose>
>         <xsl:when test="substring(Date, 10, 1) = ' '">
>                 <xsl:value-of select="substring(Date, 5, 4)" 
/>><xsl:value-of select="substring(Date, 9, 2)" /> <xsl:value-of 
> select="substring(Date, (string-length(Date) - 3), 4)" />
>         </xsl:when>
>         <xsl:otherwise>
>                 <xsl:value-of select="substring(Date, 5, 4)" 
/>><xsl:value-of select="substring(Date, 9, 3)" /> <xsl:value-of 
> select="substring(Date, (string-length(Date) - 3), 4)" />
>         </xsl:otherwise>
> </xsl:choose>

You could use:

   <xsl:value-of
      select="substring-before(substring-after(Date, ' '), ' ')" />
   <xsl:text> </xsl:text>
   <xsl:value-of
      select="substring-before(
                 substring-after(
                    substring-after(Date, ' '), ' '), ' ')" />
   <xsl:text> </xsl:text>
   <xsl:value-of
      select="substring(Date, string-length(Date) - 3, 4)" />

Oh, and remember that you need those xsl:text elements to put spaces
in between the various bits, otherwise it'll all get squished
together.
                    
I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.