开发者

decimal-string() help xml/xforms

开发者 https://www.devze.com 2022-12-14 11:02 出处:网络
i am trying to round a number to 2dp and i am struggling i am trying to use the decimal-string method

i am trying to round a number to 2dp and i am struggling

i am trying to use the decimal-string method

This is what I had

<xf:bind nodeset="/stuff/price" 
    calculate = "if(boolean-from-string(/stuff/amountOff),
    ((/stuff/items) * (/stuff/duration) * 0.8),/stuff/items* /stuff/duration)" /> 

This is what I tried

<xf:bind 
    nodeset="/stuff/price" 
    calculate = "decimal-string(if(b开发者_运维技巧oolean-from-string(/stuff/amountOff),
    ((/stuff/items) * (/stuff/duration) * 0.8),/stuff/items* /stuff/duration)" , 2)/>


Standard XForms does not support a decimal-string() function, which implementation are you using? The full list of available standard functions can be seen here (notice that it also references XPath 1.0).

Depending on your choice of XForms processor, there may be an extension function that you can use (for instance, formsPlayer exposes the format-number() function from MSXML), or you may have to define your own custom extension (e.g. in javascript) otherwise.

0

精彩评论

暂无评论...
验证码 换一张
取 消