Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 31st, 2009, 10:19 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need Help in EXSLT function str:tokenize

Hi all,

I am trying to tokenize a string that has empty space in between the delimiters(comma is used as delimiter).

I have the XSL code as shown below:

Code:
  <xsl:variable name="Test" select="',BBBB,,DDDD,EEEE'"/>
      <xsl:variable name="TestToken" select="str:tokenize($Test,',')"/>

<xsl:message>Value of first is ....<xsl:value-of select="$TestToken[1]"/></xsl:message>
<xsl:message>Value of second  is ....<xsl:value-of select="$TestToken[2]"/></xsl:message>
<xsl:message>Value of Third is ....<xsl:value-of select="$TestToken[3]"/></xsl:message>
<xsl:message>Value of Fourth is ....<xsl:value-of select="$TestToken[4]"/></xsl:message>
<xsl:message>Value of Fifth is ....<xsl:value-of select="$TestToken[5]"/></xsl:message>
Upon executing this code, I get the output as follows:

Value of first is ....BBBB
Value of second is ....DDDD
Value of Third is ....EEEE
Value of Fourth is ....
Value of Fifth is ....


But my required output is as below:

Value of first is ....
Value of second is ....BBBB
Value of Third is ....
Value of Fourth is ....EEEE
Value of Fifth is ....DDDD

I would like to know how to get the required output using str:tokenize.
I want to take the tokenized values to a variable and access it like an array like TestToken[1] (As shown the code above)

Any help appreciated.

Thanks in advance
Priby
 
Old August 31st, 2009, 01:25 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Which XSLT processor are you using? Have you tried a different processor to compare the results? I am afraid http://exslt.org/str/functions/tokenize/index.html is not specifying exactly what has to happen for edge cases.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old September 1st, 2009, 01:43 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Thanks for your reply.

I am using FOP to convert XSL to PDF and the FOP is integrated in an application. I do not have any option to change the processor.

Priby





Similar Threads
Thread Thread Starter Forum Replies Last Post
tokenize function use required - please help jamesdurham XSLT 5 April 20th, 2009 11:56 AM
help - EXSLT func cannot set more than one result! anboss XSLT 1 October 28th, 2008 02:17 PM
function node-set bound to undefined prefix exslt khwab XSLT 3 August 8th, 2007 12:31 PM
string to x-path - EXSLT - dynamic functions Geierwally XSLT 1 July 12th, 2007 10:35 AM
how to setup .mdf password to link to config str wirerider ASP.NET 2.0 Professional 9 March 4th, 2007 11:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.