0

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.

nwellnhof
  • 32,319
  • 7
  • 89
  • 113
Black Pearl
  • 79
  • 1
  • 2
  • 9

1 Answers1

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