Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2010, 07:29 AM
Authorized User
 
Join Date: Mar 2010
Posts: 45
Thanks: 6
Thanked 0 Times in 0 Posts
Default issue with format

Hi,


i am summing functional total value,

my source xml file contanins

<CF_LEDGER_CURRENCY>EUR</CF_LEDGER_CURRENCY>
<C_FUNCTIONAL_TOTAL>94,32</C_FUNCTIONAL_TOTAL>

in my xsl file i have writen like below for the column "betrag"

<element id="betrag"><xsl:value-of select="sum(key('group', concat(C_VAT_TAX_REG_NUM,C_CUST_NAME,C_TAX_REPORTI NG_NAME))/C_FUNCTIONAL_TOTAL)" /></element><xsl:text>&#xD;</xsl:text>

When iam runing the report
iam geting out put like , NaN

<element id="betrag">NaN</element>

as my functional total value is in 99,99 format how can i add these amounts in my XSl and show the out put

Thanks
Anil
 
Old March 29th, 2010, 07:36 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Is that XSLT 2.0? Then use e.g.
Code:
<xsl:value-of select="sum(key('group', concat(C_VAT_TAX_REG_NUM,C_CUST_NAME,C_TAX_REPORTING_NAME))/C_FUNCTIONAL_TOTAL/translate(., ',', '.'))" />
to convert e.g. 94,32 to 94.32.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old March 29th, 2010, 07:39 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to convert the numbers to the number format recognized by XSLT (and XML Schema).

In XSLT 2.0 you can do:

Code:
sum(key(.....)/translate(., ',', '.'))
If you're using XSLT 1.0 it's more difficult; to sum over values that are not represented directly in the nodes, but computed from the nodes, you typically need either a recursive scan over the nodes, or a two-pass solution.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old March 29th, 2010, 08:04 AM
Authorized User
 
Join Date: Mar 2010
Posts: 45
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Hi iam using Oracle XSLT version 2.0 only


but it is giving below error :

XML-22013: (Error) Error in expression: 'sum(key('group', concat(C_VAT_TAX_REG_NUM,C_CUST_NAME,C_TAX_REPORTI NG_NAME))/C_FUNCTIONAL_TOTAL/translate(., ',', '.'))'.

i mentioned like below,

<element id="betrag"><xsl:value-of select="sum(key('group', concat(C_VAT_TAX_REG_NUM,C_CUST_NAME,C_TAX_REPORTI NG_NAME))/C_FUNCTIONAL_TOTAL/translate(., ',', '.'))" /></element><xsl:text>&#xD;</xsl:text>


thanks
Anil
 
Old March 29th, 2010, 08:11 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I think it is best to use an Oracle forum then where someone is hopefully familiar with the quirks of that XSLT processor.
I think the suggestions made should work with any compliant XSLT 2.0 processor.
You could try whether
Code:
<xsl:value-of select="sum(for $e in key('group', concat(C_VAT_TAX_REG_NUM,C_CUST_NAME,C_TAX_REPORTING_NAME))/C_FUNCTIONAL_TOTAL return translate($e, ',', '.'))" />
works better but I am guessing as to what might or might not be supported by your processor.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old March 29th, 2010, 08:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't think the Oracle XSLT processor is a complete implementation of XSLT 2.0 - Check the oracle documentation for details.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old April 23rd, 2010, 09:57 AM
Authorized User
 
Join Date: Mar 2010
Posts: 45
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Hi,


it worked fine for me by using the below syntax

<xsl:value-of select="sum(for $t in current-group()/C_FUNCTIONAL_TOTAL return number(translate($t, ',.', '.')))"/>

Thanks
Anil





Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to spool // Format issue mellangerjulien Visual Basic 2005 Basics 1 September 30th, 2009 10:13 PM
XML request format issue dishant XML 5 September 7th, 2009 03:10 AM
Data Format Issue---need help please zone Excel VBA 0 August 13th, 2007 04:21 PM
Sql Insert -- date format issue feets Access VBA 2 June 12th, 2007 12:11 PM
V V V Urgent::Crystal report format issue narayanark2003 Crystal Reports 0 July 6th, 2006 07:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.