I have to transform my string in a peculiar way, as the string contains many hex values and replacement has to be applied based on some conditions.
My string contains hex values.
Always the length of string, will be a multiple of 18. The string can contain from 1* 18 to 5000*18 times(1 group to 5000 groups).
Now my output is a transformed string based on the below conditions
1) Check if the groups 13th character is 4e(13th and 14th character)
Then, change such a way that starting from 7th to 10th character(4 chars) of the string, from whatever the value is to '4040'
Also change starting from 11th till 16th(6 chars) to '4ef0f0'
The 17th and 18th to be '4040'
The whole group to be changed based on the above
2) If the check fails, no change for the group
Example if my input string is – one group and the 12th and 13th are ‘4e’
<xsl:variable name="inputstringhex"
select="'005f6f7e8f914e7175'"/>
It should be tranformed to
'005f6f40404ef0f04040'
I am using xslt1.0, and I can use only Divide and conquer method(if any recursion is used), as my xslt processor errors out if tail recursive method is used, for a large number.
You can use binary-log recursion (perhaps that is what you mean by divide and conquer? Any way, this XSLT 1.0 style-sheet…
…will produce this output…
Adapt or concatenate values of the output as required. The input is the $inputstringhex variable content. A 5000*18 length input string can be processed in only 13 levels of recursion using this solution.