gpt4 book ai didi

xslt格式-数字小数,数字小于一

转载 作者:行者123 更新时间:2023-12-02 11:42:06 34 4
gpt4 key购买 nike

我将其作为名为 $material_price 的输入:

2.40
1000
0.60

他们贯穿

<!-- setup currency rendering -->
<xsl:decimal-format name="dkk" decimal-separator="," grouping-separator="."/>
<xsl:value-of select="format-number($material_price, '#.###,00', 'dkk')"/>

输出是:

2,40
1.000,00
,60

如何更改 xslt,使最后的输出为 0,60 而不是 ,60(没有零)

最佳答案

像这样:

<xsl:value-of select="format-number($material_price, '#.##0,00', 'dkk')"/>

第二个参数(图片字符串)由documentation描述如下.

Required. Specifies the format pattern. Here are some of the characters used in the formatting pattern:

  • 0 (Digit)
  • (Digit, zero shows as absent)

  • . (The position of the decimal point Example: ###.##)
  • , (The group separator for thousands. Example: ###,###.##)
  • % (Displays the number as a percentage. Example: ##%)
  • ; (Pattern separator. The first pattern will be used for positive numbers and the second for negative numbers)

关于xslt格式-数字小数,数字小于一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2236485/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com