xslt - Formatting Xml Node using xsl -
i beginner xsl, having problem formatting node(ie unitcost) value.
i want node unitcost value ie; 5.0000(4 zeroes after decimal point) 2 zeroes after decimal point using xsl.
xml file:
<root> <item> <link>http://localhost/store/tabid/62/prodid/1/default.aspx</link> <p> <nb_store_productsinfo> <productid>1</productid> <portalid>0</portalid> <taxcategoryid>-1</taxcategoryid> <featured>false</featured> <archived>false</archived> <createdbyuser>1</createdbyuser> <createddate>2010-07-10t05:04:40.233</createddate> <isdeleted>false</isdeleted> <productref /> <lang>en-us</lang> <summary /> <description>sdcvsdcsdc&lt;br /&gt; dcsdcsdcsdcsdcsdcsdcs</description> <manufacturer /> <productname>poster1</productname> <xmldata /> <modifieddate>2010-07-10t05:25:48.077</modifieddate> <seoname /> </nb_store_productsinfo> <m> <nb_store_modelinfo> <modelid>1</modelid> <productid>1</productid> <listorder>1</listorder> <unitcost>5.0000</unitcost> <barcode/> .... reading unitcost xml file
<xsl:value-of select="./p/m/nb_store_modelinfo/unitcost" /> any appericiated..
try using format-number() function:
<xsl:value-of select="format-number(./p/m/nb_store_modelinfo/unitcost, '#.00')" />
Comments
Post a Comment