operators - XML xlst calculate value -


i'm getting number in xml 3rd part provider. need display number divided 100 , dicimals. possible in xls?

so

number = 40000

<xsl:value-of select="number" /> 

output: 40000

but need be

output: 400,00

i dont have option make input value different im getting now.

edit:

<xsl:value-ofselect="number div 100"> gives 400 

so im getting close, next formatting. im getting error: "there unclosed literal string"

<xsl:value-of select="format-number(number div 100,'###,###,##0.00')"> 

just tried <xsl:value-of select="format-number(year div 100,'###,###,##0.00')"/> on http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=tryxsl_if , worked.

full xml:

<?xml version="1.0" encoding="utf-8"?> <catalog>     <cd>         <title>empire burlesque</title>         <artist>bob dylan</artist>         <country>usa</country>         <company>columbia</company>         <price>10.90</price>         <year>40000</year>     </cd>     <cd>         <title>hide heart</title>         <artist>bonnie tyler</artist>         <country>uk</country>         <company>cbs records</company>         <price>9.90</price>         <year>1988</year>     </cd>     <cd>         <title>greatest hits</title>         <artist>dolly parton</artist>         <country>usa</country>         <company>rca</company>         <price>9.90</price>         <year>1982</year>     </cd>     <cd>         <title>still got blues</title>         <artist>gary moore</artist>         <country>uk</country>         <company>virgin records</company>         <price>10.20</price>         <year>1990</year>     </cd>     <cd>         <title>eros</title>         <artist>eros ramazzotti</artist>         <country>eu</country>         <company>bmg</company>         <price>9.90</price>         <year>1997</year>     </cd>     <cd>         <title>one night only</title>         <artist>bee gees</artist>         <country>uk</country>         <company>polydor</company>         <price>10.90</price>         <year>1998</year>     </cd>     <cd>         <title>sylvias mother</title>         <artist>dr.hook</artist>         <country>uk</country>         <company>cbs</company>         <price>8.10</price>         <year>1973</year>     </cd>     <cd>         <title>maggie may</title>         <artist>rod stewart</artist>         <country>uk</country>         <company>pickwick</company>         <price>8.50</price>         <year>1990</year>     </cd>     <cd>         <title>romanza</title>         <artist>andrea bocelli</artist>         <country>eu</country>         <company>polydor</company>         <price>10.80</price>         <year>1996</year>     </cd>     <cd>         <title>when man loves woman</title>         <artist>percy sledge</artist>         <country>usa</country>         <company>atlantic</company>         <price>8.70</price>         <year>1987</year>     </cd>     <cd>         <title>black angel</title>         <artist>savage rose</artist>         <country>eu</country>         <company>mega</company>         <price>10.90</price>         <year>1995</year>     </cd>     <cd>         <title>1999 grammy nominees</title>         <artist>many</artist>         <country>usa</country>         <company>grammy</company>         <price>10.20</price>         <year>1999</year>     </cd>     <cd>         <title>for times</title>         <artist>kenny rogers</artist>         <country>uk</country>         <company>mucik master</company>         <price>8.70</price>         <year>1995</year>     </cd>     <cd>         <title>big willie style</title>         <artist>will smith</artist>         <country>usa</country>         <company>columbia</company>         <price>9.90</price>         <year>1997</year>     </cd>     <cd>         <title>tupelo honey</title>         <artist>van morrison</artist>         <country>uk</country>         <company>polydor</company>         <price>8.20</price>         <year>1971</year>     </cd>     <cd>         <title>soulsville</title>         <artist>jorn hoel</artist>         <country>norway</country>         <company>wea</company>         <price>7.90</price>         <year>1996</year>     </cd>     <cd>         <title>the best of</title>         <artist>cat stevens</artist>         <country>uk</country>         <company>island</company>         <price>8.90</price>         <year>1990</year>     </cd>     <cd>         <title>stop</title>         <artist>sam brown</artist>         <country>uk</country>         <company>a , m</company>         <price>8.90</price>         <year>1988</year>     </cd>     <cd>         <title>bridge of spies</title>         <artist>t`pau</artist>         <country>uk</country>         <company>siren</company>         <price>7.90</price>         <year>1987</year>     </cd>     <cd>         <title>private dancer</title>         <artist>tina turner</artist>         <country>uk</country>         <company>capitol</company>         <price>8.90</price>         <year>1983</year>     </cd>     <cd>         <title>midt om natten</title>         <artist>kim larsen</artist>         <country>eu</country>         <company>medley</company>         <price>7.80</price>         <year>1983</year>     </cd>     <cd>         <title>pavarotti gala concert</title>         <artist>luciano pavarotti</artist>         <country>uk</country>         <company>decca</company>         <price>9.90</price>         <year>1991</year>     </cd>     <cd>         <title>the dock of bay</title>         <artist>otis redding</artist>         <country>usa</country>         <company>atlantic</company>         <price>7.90</price>         <year>1987</year>     </cd>     <cd>         <title>picture book</title>         <artist>simply red</artist>         <country>eu</country>         <company>elektra</company>         <price>7.20</price>         <year>1985</year>     </cd>     <cd>         <title>red</title>         <artist>the communards</artist>         <country>uk</country>         <company>london</company>         <price>7.80</price>         <year>1987</year>     </cd>     <cd>         <title>unchain heart</title>         <artist>joe cocker</artist>         <country>usa</country>         <company>emi</company>         <price>8.20</price>         <year>1987</year>     </cd> </catalog> 

full xslt:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/">   <html>   <body>     <h2>my cd collection</h2>     <table border="1">       <tr bgcolor="#9acd32">       <th>title</th>       <th>artist</th>       <th>number</th>     </tr>     <xsl:for-each select="catalog/cd">     <xsl:if test="price>10">       <tr>         <td><xsl:value-of select="title"/></td>         <td><xsl:value-of select="artist"/></td>         <td><xsl:value-of select="format-number(year div 100,'###,###,##0.00')"/></td>         </tr>     </xsl:if>     </xsl:for-each>     </table>   </body>   </html> </xsl:template> </xsl:stylesheet> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -