Say I have an element <pets animals="dogs, cats, donkey, turtle, rabbit" />

How can I break the long string to when it hits the comma, it separates the animals into substrings? An example output is shown below:

dogs
cats
donkey
turtle
rabbit

Help is appreciated.
Thanks

Recommended Answers

All 2 Replies

You could use the fn:tokenize function. fn:tokenize(pets/@animale, ",")

Tokenize is a XSLT2.0 feature. Is there any recursive template I can use in XSLT V1.0?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.