Robertone
Robertone

Reputation: 7

XSL: create an Array from a Delimited String

I have a string name "string Variable" = 'hello, hello, good Evening, good evening'. I want to create an array on which I can do a foreach with the values divided by commas.

tnks

Upvotes: 0

Views: 137

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

XSLT and XPath don't have an array data type unless you happen to use XPath 3.1 with XSLT 3. However in XSLT and XPath since version 2 there is a tokenize function you can use with e.g. tokenize('hello, hello, good Evening, good evening', ',\s*') to get a sequence of strings you can then process like any other sequence, for instance with a for-each.

Upvotes: 1

Related Questions