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

  • Home
  • SEARCH
  • 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 5940535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:58:52+00:00 2026-05-22T15:58:52+00:00

I want to ask how to get total amount if we use substring function,

  • 0

I want to ask how to get total amount if we use substring function,
for example I have this xml,

<document>

    <line id="0">
        <field id="0"><![CDATA[AAAddd17aaass]]></field>
    </line>
    <line id="1">
        <field id="0"><![CDATA[DDDaaa33sssaa]]></field>
    </line>
</document>

I should sum(substring(field[@id=’0′], 7,2)). Then I try to do that, I get this error message: Current Item is ‘NaN of type xs:string. (I try to use number function but it doesn’t help)

Please advice me how to solve it.

  • 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-22T15:58:53+00:00Added an answer on May 22, 2026 at 3:58 pm

    In XSLT 1.0 if you don’t want to write recursive templates yourself, you can use the transform-and-sum template from FXSL.

    See how to use it here.


    Here is the full transformation:

    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:f="http://fxsl.sf.net/"
    xmlns:func-transform="f:func-transform"
    exclude-result-prefixes="xsl f func-transform"
    >
       <xsl:import href="transform-and-sum.xsl"/>
    
       <!-- to be applied on testTransform-and-sum.xml -->
    
       <xsl:output method="text"/>
    
       <func-transform:func-transform/>
    
        <xsl:template match="/">
          <xsl:call-template name="transform-and-sum">
            <xsl:with-param name="pFuncTransform"
                            select="document('')/*/func-transform:*[1]"/>
            <xsl:with-param name="pList" select="/*/*/*"/>
          </xsl:call-template>
        </xsl:template>
    
        <xsl:template match="func-transform:*" mode="f:FXSL">
          <xsl:param name="arg1" select="0"/>
          <xsl:value-of select="number(substring($arg1, 7,2))"/>
        </xsl:template>
    
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <document>
        <line id="0">
            <field id="0"><![CDATA[AAAddd17aaass]]></field>
        </line>
        <line id="1">
            <field id="0"><![CDATA[DDDaaa33sssaa]]></field>
        </line>
    </document>
    

    the wanted, correct result is produced:

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

Sidebar

Related Questions

I want to ask some questions about the JSP and JSON file. I have
I want to use a temp directory that will be unique to this build.
so I want to ask, and forgive me if this is obvious, or newbie
Using Python v2.x, I have 3 variables that I want to ask the user
I want to ask how to get the value of var title : From
Q: I want to ask about how to get the Computer name and the
I know this questions get ask a lot, and Kelly Chan did provide an
I have a script and want to ask the user for some information, but
hihi i have a question that i want to ask about c# and window
i want ask some question about asp.net mvc Is static constructor will init every

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.