How to get only numbers from string in XSLT


To get only numeric value from input string we can use translate function in XSLT.

  <ns0:result>
            <xsl:value-of select="translate (/ns0:process/ns0:input, translate (/ns0:process/ns0:input, '0123456789', '' ), '')"/>
           
     </ns0:result>



/ns0:process/ns0:input is having string  from which numeric value should be get.

nested translate function will work as below.

  1.  Inner translate(). This produces all characters of the string, except digits.
  2.  Outer translate(). This deletes from the string all characters produced by the inner translate(). What remains is just the wanted characters (the digits).





Comments

Popular posts from this blog

SOA interview questions

[JMSClientExceptions:055144]Destination must be a topic