我在BizTalk中处理一个项目,其中使用xslt将edifact文件和xslt文件转换为UBL文件。edifact文件包含###.0的价格值,但不起作用。我想使用format-number将其更改为###.00。但我不能让它工作。
这是我到目前为止所做的:
<cbc:Value>
<xsl:variable name="SumOfNodes" select="edi:PRI/edi:C509/C50902"/>
<xsl:value-of select="format-number($SumOfNodes, '0.00')"/>
</cbc:Value>
我正在使用这个样式表:
<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:edi="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006/MEDIAMARKT"
xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Order-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
exclude-result-prefixes="msxsl edi">
有什么办法解决这个问题吗??
发布于 2013-07-05 19:57:01
这可能是由于XSLT中未声明的名称空间造成的。请检查XSLT中是否正确声明了命名空间。除非您使用XML编码展示完整的XSLT编码,否则我们无法提供解决方案。但是,请参考下面的示例XML和XSLT以及输出
XSLT:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="chapter">
<Value>
<xsl:variable name="num" select="number"/>
<xsl:value-of select="format-number($num,'00.00')"/>
</Value>
</xsl:template>
</xsl:stylesheet>
示例XML
<?xml version="1.0"?>
<chapter>
<number>45</number>
</chapter>
输出
<?xml version='1.0' ?>
<Value>45.00</Value>
https://stackoverflow.com/questions/17488088
复制相似问题