I\'m trying to use XSLT to convert a simple XML schema to HTML and planned to use ;fn:replace
to replace returns (\\n
) with
.
XPath 2.0 has a replace function that you can use with any XSLT 2.0 processor like Saxon 9 or AltovaXML tools or Gestalt. You seem to try to use the function with an XSLT 1.0 processor, that is not going to work. In case you are restricted to an XSLT 1.0 processor you will need to implement the replacement with a named recursive template or with the help of an extension.
However note that even with XSLT 2.0 your attempt to use replace seems wrong as you will produce a text node with a 'p' tag markup while I assume you want to create a 'p' element node in the result. So even with XSLT 2.0 using analyze-string instead of replace is more likely to get you the result you want.
By bumping the version attribute of <xsl:stylesheet>
to 2.0 and using
<xsl:value-of select="replace(description, '\n', '<p/>')" disable-output-escaping="yes" />
I was able to make the replace work.