Xml 由于特殊字符,包含(@title,“”)看起来不起作用
我有如下类似的XML节点-Xml 由于特殊字符,包含(@title,“”)看起来不起作用,xml,xslt,Xml,Xslt,我有如下类似的XML节点- <url title="Take the STARPLUS® for entertaiment" depth="2" is_external="False"/> <xsl:when test="contains(@title,'®')"> <!-- Make registration mark super scripted--> </xsl:when> <xsl:otherwise> <xsl:va
<url title="Take the STARPLUS® for entertaiment" depth="2" is_external="False"/>
<xsl:when test="contains(@title,'®')">
<!-- Make registration mark super scripted-->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@title"/>
</xsl:otherwise>
</xsl:choose>
现在在XSLT中,我正在编写如下代码-
<url title="Take the STARPLUS® for entertaiment" depth="2" is_external="False"/>
<xsl:when test="contains(@title,'®')">
<!-- Make registration mark super scripted-->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@title"/>
</xsl:otherwise>
</xsl:choose>
这里contains@title,“®”由于特殊字符,看起来不起作用
谁能帮我写下这个XSLT检查
注意-我不能用XML进行编码或转义,因为系统中已经有了XML
谢谢这个测试应该可以正常工作。您可以尝试改用实体引用:
contains(@title,'®')
下面是两个匹配正确的示例
XML输入
XSLT1.0
输出
是的Deniel我不知道为什么=contains@title,“®”在我的情况下不起作用。但是contains@title,'&174;' 工作:-非常感谢您的快速回答。
<has_reg>Take the STARPLUS® for entertaiment</has_reg>
<has_reg>Take the STARPLUS® for entertaiment</has_reg>