I need to remove the following characters from a string value using xsl 1.0
*, /, \, #, %, !, @, $, (, ), &
I have come up with the following:
translate(translate(translate(string(//xpath/@value),'.',''),'/',''),',','')
In the above approach, I would have to duplicate the same code many times (one time per character).
How can I achieve the same goal without duplicating the code?
Thanks 🙂
You simply need
translate(//foo/@value, '*\%!@$&', '')in pure XPath respectively inside of an XML document like an XSLT stylesheet you need to escape the ampersand<xsl:value-of select="translate(//foo/@value, '*\%!@$&', '')"/>.