我对此问题的理解是,如果XPath表达式位于XML文档中,则需要使用嵌套引号引起问题。
如果是这样的情况下,可以使用该XPath表达式:
$yourString = "This is my string with value '40' to be asserted."
XSLT - 基于验证:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:copy-of select=
"/* = "This is my string with value '40' to be asserted.""/>
</xsl:template>
</xsl:stylesheet>
当施加于下面的XML文档这种转变:
<t>This is my string with value '40' to be asserted.</t>
XPath表达式进行评估,此评估的结果复制到输出:
true
你想测试整个字符串等于一个特定的值,或者该字符串只包含' '40'? –