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 <p>. However, I can't figure out how to use this function properly.
A simplified version of the XSLT I'm using reads:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:fn="http://www.w3.org/2005/xpath-functions">
  <xsl:template match="/root">
    <html>
      <body>
        <!-- Replace \n with <p> -->
        <xsl:value-of select="fn:replace(value, '\n', '<p>')" />
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
And the input to this XLST is e.g.:
<?xml version="1.0"?>
<root>
  <value><![CDATA[
    Hello
    world!
  ]]></value>
</root>
However, the conversion fails on fn:replace with an NoSuchMethodException. Note if I change the replace statement to
<xsl:value-of select="fn:replace('somestring', '\n', '<p>')" />
I get an IllegalArgumentException. How do I use fn:replace to achieve what I want?
I'm using Butterfly XML Editor to test the XSLT.