xslt - 删除点后的值

标签 xslt

我想删除点后的零或任何其他值(例如 12.000000000000)。 我正在使用 xslt 代码。我的代码就像

<xsl:if test="value!= ''">
 <tr>
 <td>
 value
 </td>
 <td>
 <xsl:value-of select="value"/>
  </td>
 </tr>
 </xsl:if>

我怎样才能做到这一点?

最佳答案

Use Number formatting as:
<xsl:if test="value!= ''">
 <tr>
  <td>
    value
  </td>
  <td>
   <xsl:value-of select="format-number(value,'0')"/>
  </td>
 </tr>
</xsl:if>

关于xslt - 删除点后的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15564872/

相关文章:

xslt - 为什么我不能在 XSL 中获取与应用模板一起使用的参数?

xml - XPath 能否仅返回具有 X 的子节点的节点?

xslt - 使字符串小写 XSLT

html - 使用 XSLT 将第一个 HTML 表格行转换为每个表格的标题行

javascript - Java EE 应用程序的 UI 技术

xslt - MarkLogic:尝试理解错误 "Node has complex type with non-mixed complex content"

xslt - 使用 XSLT 在字符串中添加数字

Java:处理大型 XML 文件 - 无需编码状态自动机即可提取数据?

java - 使用java将多个xml文件转换为html文件

xml - xslt 生成当前位置的元素和嵌套节点中下一个的值