在XSLT 2.0中,是否可以使用if then只表示没有else子句。如果我不想要else子句,则表示如果<Employee><Status><xsl:value-of select="if (tns:Employee/tns:EmpId = 4) then 'new' else 'old'"/></Status></Employee>不是4,则不填充状态字段。什么是xslt?
发布于 2015-04-15 03:33:15
除非我读错了问题,否则只需添加一个空字符串或空序列。
例如。
if (tns:Employee/tns:EmpId = 4) then 'new' else ''或
if (tns:Employee/tns:EmpId = 4) then 'new' else ()发布于 2015-04-15 20:29:56
如果您根本不需要任何status,那么可以使用XSLT中的标准xsl:if (在所有版本中都可用)轻松地实现这一点。
<Employee>
<xsl:if test="tns:Employee/tns:EmpId = 4">
<Status>new</Status>
</xsl:if>
</Employee>https://stackoverflow.com/questions/29635552
复制相似问题