EXSLT - str:split

Implementer Page: str.split.html
Function Package: str.split.zip

Function Syntax

node-set str:split(string, string?)

Template Syntax

<xsl:call-template name="str:split">
   <xsl:with-param name="string" select="string" />
   <xsl:with-param name="pattern" select="string" />?
</xsl:call-template>

The str:split function splits up a string and returns a node set of token elements, each containing one token from the string.

The first argument is the string to be split. The second argument is a pattern string. The string given by the first argument is split at any occurrence of this pattern. For example:

str:split('a, simple, list', ', ')      
      

Gives the node set consisting of:

<token>a</token>
<token>simple</token>
<token>list</token>

If the second argument is omitted, the default is the string '&#x20;' (i.e. a space). Thus:

str:split('date math str')      
      

Gives the node set consisting of:

<token>date</token>
<token>math</token>
<token>str</token>

If the second argument is an empty string, the function returns a set of token elements, each of which holds a single character. Thus:

str:split('foo', '')          
        

Gives the node set consisting of:

<token>f</token>
<token>o</token>
<token>o</token>

The template version of this function returns a result tree fragment consisting of a number of token elements.

Implementations

The following XSLT processors support str:split:

Implementations of str:split are available in the following languages:

http://www.exslt.org/str/functions/split/index.html last modified 2002-08-20