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

Re: TOKENISER

Subject: Re: TOKENISER
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 27 Feb 2002 07:06:58 -0800 (PST)
tokeniser
> i have a variable day defined as
> <xsl:variable name = "day" select="/date"/>
> 
> which has a value Tuesday 26 February 2002
> 
> can i separate each of them to get
> 
> Tuesday
> 26
> February
> 2002
> 
> using some kind of string functions in xsl..
> i am not able to separate them

Use the FXSL str-split-to-words function. One advantage is that the
delimiteres between words can be many and dynamically specified as a
parameter.

In your case the following transformation:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

   <xsl:import href="strSplit-to-Words.xsl"/>

   <!-- to be applied on words.xml -->

   <xsl:output indent="yes" omit-xml-declaration="yes"/>
   
    <xsl:template match="/">
      <xsl:call-template name="str-split-to-words">
        <xsl:with-param name="pStr" 
                        select="'Tuesday 26 February 2002'"/>
        <xsl:with-param name="pDelimiters" select="',
&#9;&#10;&#13;'"/>
      </xsl:call-template>
    </xsl:template>

</xsl:stylesheet>

produces the following result:

<word>Tuesday</word>
<word>26</word>
<word>February</word>
<word>2002</word>

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

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


Current Thread
  • Re: TOKENISER
    • Dimitre Novatchev - Wed, 27 Feb 2002 10:03:42 -0500 (EST) <=

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.