Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Converting JavaScript Function to XSLT
    var epcSum = 0;
    var labourSum = 0;
    var bvatSum = 0;
    var avatSum = 0;
    var vatSum = 0;
    var discount = 0;
    
    function addToSum(type, amount) {
        try {
            if(type=='A') epcSum += new Number(amount);
            if(type=='B') labourSum += new Number(amount);
            if(type=='C') vatSum += new Number(amount);
            if(type=='D') discount += new Number(amount);
        } catch (e) {}
        
        return '';
    }

I am not finding the way how to implement "+=" operator and using the global variable inside function . Please anybody help me to convert this javascript function to XSLT template or function.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

We need to understand the problem you are trying to solve at a higher level. You've shown us some very procedural code that relies on a function having side-effects by updating global variables. That's simply not the way a declarative, functional language like XSLT works. The XSLT code for this problem is probably easier to derive from a high-level requirements statement that from an existing low-level implementation.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!