XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Justin SmithSubject: Help using the fn:tokenize function
Author: Justin Smith
Date: 14 Jun 2007 04:12 PM
Originally Posted: 14 Jun 2007 03:39 PM
Hello everyone,

I am attempting to use the tokenize(string, delimiter) function and having some trouble. I would like to tokenize a string, assign it to a variable, and then loop through each element in the string. Unfortunately, I can't even seem to get the tokenize function to work properly.

For a test, I have tried a few different syntaxes such as <fn:tokenize select="('a;b;c', ';')" /> and
<xsl:variable name="stringTest">
<fn:tokenize select=("a;b;c", ";")' />
</xsl:variable>
<xsl:value-of select="$stringTest" />

but can't seem to get the output I desire. I either end up with the empty string as output, or a tag reading <fn:tokenize select='('a;b;c', ';' />.

Also, if anyone would be willing to tell me how to assign the tokenized string to a variable, or loop through the list of tokenized strings I would greatly appreciate the help.

Update:
I seem to have figured out the syntax, but msxsl keeps telling me that the function tokenize does not exist? Any suggestions?

Thank you for your time and consideration.

Postnext
Ivan PedruzziSubject: Help using the fn:tokenize function
Author: Ivan Pedruzzi
Date: 14 Jun 2007 04:12 PM
----------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<tokens>
<xsl:for-each select="tokenize('a;b;c',';')">
<token>
<xsl:value-of select="."/>
</token>
</xsl:for-each>
</tokens>
</xsl:template>
</xsl:stylesheet>

----------------------------------------------------
<?xml version='1.0' ?>
<tokens>
<token>a</token>
<token>b</token>
<token>c</token>
</tokens>

Ivan Pedruzzi
Stylus Studio Team

Posttop
Justin SmithSubject: Help using the fn:tokenize function
Author: Justin Smith
Date: 14 Jun 2007 06:28 PM
Thank you very much for your help.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.