I need to transform input paramater string like “1-410000 54-420987 63-32000” into the structure (like below) inside xslt to use its data later in xslt:
<config:categories>
<category>
<value>410000</value>
<label>1</label>
</category>
<category>
<value>420987</value>
<label>54</label>
</category>
<category>
<value>32000</value>
<label>63</label>
</category>
</config:categories>
P.S.
Are there any other options to parse string like “1-410000 54-420987 63-32000” in order to use its data in xslt to extract the right part (after the ‘-‘) if the left part is found in input document?
This transformation:
when applied on any XML document (not used), produces the wanted, correct result:
Explanation:
Proper use of
substring-before()andsubstring-after()plus recursion.