如果在元素<remove>some text</remove>
之后直接加上双引号,则必须删除双引号。例如
这将被解释为“关于动词” 与某些“植物”相对应 在
上应该是
这将以动词相关解释 还有一些植物等等
<p>This is to be interpreted in "<remove>about verb</remove>" accordance with something "<remove>some of plants</remove>" and so on</p>
应该是
<p>This is to be interpreted in <remove>about verb</remove> accordance with something <remove>some of plants</remove> and so on</p>
答案 0 :(得分:3)
在 XSLT 1.0 中,可以通过以下方式处理:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:variable name="s" select="preceding-sibling::node()[1][self::remove] and starts-with(., '"')"/>
<xsl:variable name="e" select="following-sibling::node()[1][self::remove] and substring(., string-length(.))='"'"/>
<xsl:value-of select="substring(., 1 + $s, string-length(.) -$s -$e)"/>
</xsl:template>
</xsl:stylesheet>
答案 1 :(得分:-1)
对于2.0,您可以使用fn:replace():
replace(//p,'"','')