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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:17:54+00:00 2026-05-26T06:17:54+00:00

I am trying to print variable value in second for loop of xslt but

  • 0

I am trying to print variable value in second for loop of xslt but not getting displayed
here is my code

<xsl:for-each select="CampaignData/Mailer/CustomerInfo/CustInfFld/Coupons/Cust_Sel_Coupons">
                <xsl:sort select="@CouponPosition"/>
                    <xsl:variable name="CouponID">
                        <xsl:value-of select="@CouponID"/>
                    </xsl:variable>

                        <xsl:for-each select="CampaignData/Mailer/Coupons/Cntr_Sel_Coupons">
                        <div style='color:red;'><xsl:value-of select='$CouponID'/></div>

                </xsl:for-each>
            </xsl:for-each>
  • 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-26T06:17:55+00:00Added an answer on May 26, 2026 at 6:17 am

    The select attribute of the nested xsl:for-each doesn’t select anything and this is why its body isn’t executed even once.

    Inside the inner xsl:for-each your current node is of the form:

    CampaignData/Mailer/CustomerInfo/CustInfFld/Coupons/Cust_Sel_Coupons
    

    The select attribute of the inner xsl:for-each specifies:

    CampaignData/Mailer/Coupons/Cntr_Sel_Coupons
    

    this is a relative XPath expression and it is resolved off the current node. Thus, the specified select for the inner xsl:for-each is actually (from outside of the outer xsl:for-each):

    CampaignData/Mailer/CustomerInfo/CustInfFld/Coupons/Cust_Sel_Coupons
                                    /CampaignData/Mailer/Coupons/Cntr_Sel_Coupons
    

    It is highly unlikely there are any such nodes in the source XML document that you haven’t shown.

    Without having the source XML it isn’t possible to say what exactly the relative expression should be — most likely:

    Change:

    <xsl:for-each select=
         "CampaignData/Mailer/Coupons/Cntr_Sel_Coupons"> 
    

    to:

    <xsl:for-each select=
         "../../../../Coupons/Cntr_Sel_Coupons"> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to print the second member variable of all items in an stl
I am trying to print a variable value within the javascript function. If the
I'm trying to store a url such as: http://localhost/pro_print/index.php#page=home in a variable, but I
I've just encountered a weird problem, I'm trying to printf an integer variable, but
I'm trying to print the output of function only when it is true but
I am trying to print invoice. But top whatever i do to setting margins,
I was trying a program to understand the behavior of structure variable, Sample code:
I am trying to get Session Value and store in the variable.. how can
here's what i'm trying to do. I have a variable coming from a PHP
I'm trying to pass a variable from the URL (not the query string) to

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.