Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 549925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:14:05+00:00 2026-05-13T11:14:05+00:00

I am currently building a XML based Jasper Report in which I am trying

  • 0

I am currently building a XML based Jasper Report in which I am trying to add a tax percent onto the cost.

A problem occurs when I use sum(//net-total) to value calculate the total cost. When the summed total has no decimal places it returns and Integer and I need a double.

I have tried sum(//net-total) * 1.0 but it doesn’t seem to work.

Does anyone have any ideas?

Please feel free to correct me if I am taking the wrong approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:14:06+00:00Added an answer on May 13, 2026 at 11:14 am

    The problem is that by definition (of XML) a double must have a decimal point (.)

    [ http://www.w3.org/TR/xmlschema-2/#double ]

    You should take a look at the XSLT format-number() Function ..

    for example format-number(sum(//net-total), "#.00") would enforce a two decimal digits representation ..

    [EDIT]

    Since you want it for XPATH 1, which unfortunately does not support conditional expressions nor string formatting , it is not possible to do it in a signle xpath expression …

    if however you can create a node (sum-total) with the sum of the //net-total then you could use a little workaround

    concat(
    //sum-total,
    substring( concat(//sum-total,".00"), 1, number( not(contains(//sum-total,".")))*1000  )
    )
    

    which will add .00 if there is no . in the node value ..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building an XSD to validate some XML I'm working on, I'm guessing
I'm building an XML-based webservice in Rails to serve as the backend for an
I'm currently in the process of building a CRUD tool for an existing Spring-based
I am currently building an XML schema, with a head, a body, and potentially
I'm currently using Fusioncharts Free in my project which requires XML to be in
I'm currently building large xml files with xml.dom.minidom and then writing them out to
I am currently building an Excel 2007 Add-in using VSTO (latest version + sp1)
related Design Strongly typed object from XML Currently we run stored procedures based on
I am building an application which works on data from column based database. I
My code is currently building with no errors. It is searching in an xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.