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 8836771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:34:14+00:00 2026-06-14T09:34:14+00:00

I have a requirement in my code and it is as follows: The Parameters

  • 0

I have a requirement in my code and it is as follows:

The

  • Parameters in my Java program are passed to an XSLT(X1) for processing. The X1 returns only one String value.
  • Another set of Parameters are passed to another XSLT(X2) for processing.The X2 also returns only one String value.
  • After Transformations the XSLT results need to be passed to another XSLT(X3) which would use the value as Variables and generate result basis the results from X1 and X2.

As far as i have been studied the XSLT variables values cannot be modified once stored. and also that these values are received as parameters when calling <xsl:apply-template name=”someTemplate” > and with parameter tags.

i can implement this functionality by retrieving the result into String in Java and again Passing them as parameters to the next template. but i wanted to know if the same can be done directly via XSLT.

Please help

Edit: Xalan removed as tag

  • 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-06-14T09:34:15+00:00Added an answer on June 14, 2026 at 9:34 am

    i can implement this functionality by retrieving the result into
    String in Java and again Passing them as parameters to the next
    template. but i wanted to know if the same can be done directly via
    XSLT.

    Yes, here is an XSLT 2.0 example:

    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
        <xsl:param name="pP1" select="2"/>
        <xsl:param name="pP2" select="3"/>
        <xsl:param name="pP3" select="5"/>
    
        <xsl:variable name="vPass1">
         <xsl:apply-templates mode="pass1">
           <xsl:with-param name="pP1" select="$pP1"/>
         </xsl:apply-templates>
        </xsl:variable>
    
        <xsl:variable name="vPass2">
         <xsl:apply-templates mode="pass2">
           <xsl:with-param name="pP2" select="$pP2"/>
         </xsl:apply-templates>
        </xsl:variable>
    
        <xsl:variable name="vPass3">
         <xsl:apply-templates mode="pass3">
           <xsl:with-param name="pP3" select="$pP3"/>
         </xsl:apply-templates>
        </xsl:variable>
    
     <xsl:template match="/">
         <xsl:value-of select="$vPass1 + $vPass2 + $vPass3"/>
     </xsl:template>
    
     <xsl:template match="/*" mode="pass1">
      <xsl:param name="pP1" as="xs:integer"/>
      <xsl:value-of select="sum(*[. mod $pP1 = 0])"/>
     </xsl:template>
    
     <xsl:template match="/*" mode="pass2">
      <xsl:param name="pP2" as="xs:integer"/>
      <xsl:value-of select="sum(*[. mod $pP2 = 0])"/>
     </xsl:template>
    
     <xsl:template match="/*" mode="pass3">
      <xsl:param name="pP3" as="xs:integer"/>
      <xsl:value-of select="sum(*[. mod $pP3 = 0])"/>
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on the following XML document:

    <nums>
      <num>01</num>
      <num>02</num>
      <num>03</num>
      <num>04</num>
      <num>05</num>
      <num>06</num>
      <num>07</num>
      <num>08</num>
      <num>09</num>
      <num>10</num>
    </nums>
    

    three passes are performed, each with its own parameters. Each pass computes the sum of num elements, whose value is multiple of the supplied parameter. Finally, the results of the three passes are summed and returned as the final result:

    63
    

    Exactly the same transformation can be run with an XSLT 1.0 processor, with the exception that any string "as='xs:integer'" must be removed from the code.

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

Sidebar

Related Questions

I wrote below code to satisfy program requirement as follows: Average of Three Write
Hi i have requirement to process large number of files via multithreading in java.
I have written a code that draws grids and a triangle inside one grid
I have to implement a strange requirement that goes as follows: Users can hover
I have a small requirement and that is as follows: I am calling a
I have a small requirement and that is as follows: I have a login
Context : We have business requirement that a value is reported at 3 or
I have requirement where some times I would like to load children as well
I have requirement to disable copy/paste/cut operations on a textbox. For this purpose I
I have requirement, wherein I have to calculate totals for cash and credit cards

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.