Solved

XPath in XQuery:  Fractional Digits

Posted on 2015-01-21
1
81 Views
Last Modified: 2015-01-21
XPath in XQuery:  Fractional Digits

I have an output XSD that looks like this

  <xs:simpleType name="Money">
    <xs:restriction base="xs:decimal">
         <xs:fractionDigits value="2"/>
     </xs:restriction>
  </xs:simpleType>

Open in new window


From this I use a statments

[cfn:sum($Accounts/in:IndividualAcct[in:AcctType = 'AttcRec']/in:balance * in:amount)

Open in new window


But my summation to a field defined witht the
definition above appears as:

36745.770000000004

Open in new window


What I want is for this to display only 2 fractional digits

So I am wondering, can I use something like a format-string or fn:string

If so, can I combine this with my previous fn:sum string listed above

What would that look like?

Thanks
0
Comment
Question by:Anthony Lucia
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 40563080
you need format-number()

format-number(cfn:sum($Accounts/in:IndividualAcct[in:AcctType = 'AttcRec']/in:balance * in:amount), '0.00')
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS SQL Database Generating XML using query 21 37
diffSum example 4 26
expectj telnet failing 5 26
eclipse apache tomcat admin console 45 55
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now