【发布时间】:2014-11-06 04:51:52
【问题描述】:
我有 xml 文件,其中包含一组日期,当它是 BCE 时为负数,如果是 CE 时为正数。我需要通过乘以 -1 将负值更改为正值,我该怎么做?
<xsl:choose>
<xsl:when test="node < 0">
<p><xsl:value-of select="node"/> BCE</p> <!-- How to multiply by -1? -->
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select="node"/> CE</p>
</xsl:otherwise>
</xsl:choose>
【问题讨论】:
-
你的例子中
value和node有什么区别? -
node 是节点名称,value 是它的值,例如:
<parent><node>value</node><parent> -
你的测试应该是这样的:
<xsl:when test="node &lt; 0">. -
是的,你是对的,很抱歉造成混乱