I have a string of 15 bytes. For example, it is an ip address. (123.45.67.890) I need to add leading zeroes like this (123.045.067.890) and then remove the decimals (123045067890). The final out should have only 12 bytes after adding zeroes and removing decimals. I need to do this in xslt/xml. Please put your thoughts.
Asked
Active
Viewed 47 times
0
-
Which specific XSLT processor will you be using? – michael.hor257k Apr 20 '17 at 08:09
-
I am using XSLT 1.0 – Black Pearl Apr 20 '17 at 11:36
-
But which XSLT 1.0 processor? If you don't know, see here how to find out: http://stackoverflow.com/questions/25244370/how-can-i-check-which-xslt-processor-is-being-used-in-solr/25245033#25245033 – michael.hor257k Apr 20 '17 at 13:31
1 Answers
1
If your processor supports XSLT 2.0, you could do:
<xsl:value-of select="for $i in tokenize($ip, '\.') return format-number(number($i), '000')" separator=""/>

michael.hor257k
- 113,275
- 6
- 33
- 51
-
Thanks Michael. What does the variable ' i ' specify in this code? – Black Pearl Apr 20 '17 at 11:20