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

Re: A function that tokenizes a string, wrapping each

Subject: Re: A function that tokenizes a string, wrapping each token in start-tag , end-tag pairs?
From: "Costello, Roger L. costello@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Apr 2016 12:52:12 -0000
Re:  A function that tokenizes a string
You rock Martin!


Okay, I changed the implementation as you suggested, see below. The new
implementation is much shorter and much clearer. Can it be improved even

    	Create an element for each non-empty token in $line.
    	$line is tokenized using the sequence of symbols denoted
    	by $line-delimiter.
    	For the token at position i, name the element using the
    	string in headers[$i]
    <xsl:function name="f:line" as="element()*">
   	<xsl:param name="line" as="xs:string" />
    	<xsl:param name="delimiter" as="xs:integer+" />
        	<xsl:param name="headers" as="xs:string+" />

    	<xsl:for-each select="tokenize($line,
    		<xsl:if test=". ne ''">
    			<xsl:variable name="pos" select="position()" />
    			<xsl:element name="{$headers[$pos]}">
    				<xsl:sequence select="."/>


Current Thread


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.
First Name
Last Name
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.