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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:30:32+00:00 2026-05-14T21:30:32+00:00

The situation is I have two xslt files: one is called from my ASP.NET

  • 0

The situation is I have two xslt files: one is called from my ASP.NET code, and there, the second xslt file is imported.

What I’d like to accomplish is to pass a parameter to the first one so the second xslt(the one that is imported at the first xslt) can read it.

My c# code looks like this:

    var oArgs = new XsltArgumentList();
    oArgs.AddParam("fbLikeFeatureName", "", "Facebook_Like_Button");
    ltlContentBody.Text = xmlUtil.TransformXML(oXmlDoc, Server.MapPath(eSpaceId + "/styles/ExploringXSLT/ExploreContentObjects.xslt"), true);

And I’m catching the param at the first xslt this way:

<xsl:param name="fbLikeFeatureName" />

And then, passing it to the second xslt like this(previously, I import that file):

<xsl:call-template name="Articles">
    <xsl:with-param name="fbLikeFeatureName"></xsl:with-param>
  </xsl:call-template>

Finally, I’m catching the param on the second xslt file as following:

<xsl:value-of select="$fbLikeButtonName"/>

What Am I doing wrong? I’m kind of new at xslt.

  • 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-14T21:30:32+00:00Added an answer on May 14, 2026 at 9:30 pm

    You don’t need to “pass” the parameter from the first stylesheet to the imported stylesheet. When you declare the param at the top level on the first stylesheet, it is automatically visible to all imported stylesheets. Consider the following stylesheets:

    template1.xsl:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:import href="template2.xsl"/>
        <xsl:param name="input-param"/>
        <xsl:template match="/">
            <xsl:apply-templates select="doc"/>
        </xsl:template>
    </xsl:stylesheet>
    

    Which imports template2.xsl:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="text"/>
        <xsl:template match="doc">
            <xsl:value-of select="$input-param"/>
        </xsl:template>
    </xsl:stylesheet>
    

    I then transformed the following doc:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="template1.xsl"?>
    <doc/>
    

    with the input parameter “input-param” set to “This is a test”. I get the following output (Saxon-B 9.1.0.7):

    This is a test
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my situation: I have two org.w3c.dom.Document created from two xml files. What
Consider the following situation: We have two Localizable.string files, one in en.lproj and one
This is situation I have: I have two entities with one-to-many relationship mapped like
I have two situation, currently I'm run my script from two different places with
I have two files: groundup.xml and groundup.xslt. groundup.xml: <content> <root> <housing_option_name>The first name</housing_option_name> <housing_option_headline>Live
Let me explain the situation I have two tables: -One is to store the
Here is the situation: I have inherited two separate machines, one used for development
I am in a situation whereby I have two sites, one a sub-domain of
Situation I have two .NET solutions ( Foo and Bar ) and a common
Here's my situation: I have two pages. I use this line of code 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.