Delmitting / Splitting Attribute Values in XSLT
Posted on 2003-03-14
I need to split an attribute value and I need to do this in a loop.
my xml file:
<att1 val="8/10/12"> </att1>
I need to iterate over val and split into 8,10,12 or say 8,10,12,14 or 10,12,14,16. I cannot change the xml to something more sensible like child nodes for each value.
I can think of an algorithmn with
string = substring-before(string, substring)
string = substring-after(string, substring)
I ask for the string before and after, so the first time I get 8 & 10/12. Then I do it again and I get 10 & 12.
Voila!, but I need to do it in a loop (so I can deal with 8/10/12/16/18, and the only looping I can find is for-each! does any one clever have any ideas?