【发布时间】:2017-08-17 10:27:24
【问题描述】:
XML:
<root></root>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<xsl:template match="/root">
absent_node EQUALS zero-length string [<xsl:value-of select="absent_node=''"/>];
absent_node NOT EQUALS zero-length string via != [<xsl:value-of select="absent_node!=''"/>]
</xsl:template>
</xsl:stylesheet>
结果:
absent_node EQUALS zero-length string [false];
absent_node NOT EQUALS zero-length string [false]
我看到了similar issue with python,但这里需要解释一下。
如果我想在不通过 text() 或 string() 进行显式值类型转换的情况下获得正好相反的结果,是否首选使用 not()?
【问题讨论】: