我正在使用 xslt 1.0 来转换我的 xml。
我有这个字符串:
hello 1s: This is very nice day. 9s: Christmas is about to come 14s: and christmas preparation is just on 25s: this is awesome!!
我想像这样格式化它:
hello This is very nice day. Christmas is about to come and christmas preparation is just on this is awesome!!
为此,我尝试了这个 xslt:
<?xml version='1.0' encoding='UTF-8' ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:regexp="http://exslt.org/regular-expressions"
extension-element-prefixes="regexp" >
<xsl:import href="regexp.xsl" />
<xsl:template match='/'>
<xsl:value-of select="regexp:replace(string(.), '[0-9]{1,4}s: ', 'g', '')" />
</xsl:template>
</xsl:stylesheet>
但是当我运行它时出现以下错误:
java.lang.NoSuchMethodException: For extension function, could not find method java.lang.String.replace([ExpressionContext,] #STRING, #STRING, #STRING).
我究竟做错了什么?