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
  • 30,198
  • 7
  • 82
  • 110
Black Pearl
  • 59
  • 1
  • 1
  • 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
  • 105,853
  • 6
  • 31
  • 49