[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Is there a way to skip non-numerical data while forma
Hello Everyone,
I'm using XSLT 1.0 , and I'm trying to format numerical data in the price, shipping elements of the input XML as fillows: <xsl:value-of select="format-number(number(price), '##,##,.00')"/> <xsl:value-of select="format-number(number(shipping), '##,##,.00')"/> <xsl:value-of select="format-number(number(price+shipping), '##,##,.00')"/> The above formatting works well, except when a non-numeric data is encountered in the price or shipping nodes. The above statements result in a value of NaN -- I was hoping for a blank value instead of getting a value of NaN. I'm trying to find the best way to handle the above case, I was thinking of checking the type of the price and shipping nodes with an xsl:if statements before attempting to format them - but adding an xsl:if each time reduces the response time of the resulting document because every price/ shipping node would be checked. Please suggest if there is a better way to suppress the NaN in the event that the node contains a non-numeric value. Any suggestions appreciated. -Rashmi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|