EXSLT - str:split - Implementer Page

Version: 1
Status: new
User Page: index.html
XML Definition: str.split.xml
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.

An implementation of this extension function in the EXSLT str namespace must conform to the behaviour described in this document.

Implementations

Built-in support for str:split is available in the following XSLT processors:

ProcessorProcessor VersionImplemented Version
4XSLT, from 4Suite.0.12.0a31

The following implementations of str:split are available:

LanguageImplemented VersionCreatorDateDownload
EXSLT Function1Kipp Howard2001-10-15str.split.function.xsl
XSLT Template1Kipp Howard2001-10-15str.split.template.xsl

Change History

Submitted: 2001-10-15
Creator: Kipp Howard

The str:split function splits a string at the occurrences of a pattern string.
VersionModifiedByDetails
1.12002-08-20Craig Stewart

Added 4XSLT implementation to the list.

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