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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:56:38+00:00 2026-06-05T13:56:38+00:00

i have a user control in which i want to pass page url to

  • 0

i have a user control in which i want to pass page url to my XSL sheet and apply it to my XML file . as a result of it should produce some HTML output. Please explain how to do this?

xml file name: myXml.xml 
Xsl file name: mwXsl.xsl
Parameter to be passed by usercontrol(.cs) file: url of parent page.

i’ve defined XSL stylesheet. All i need to pass the argument to that file. in usercontrol(ascx) file i have this code

<asp:Xml ID="BControl" runat="server" DocumentSource="/wsitemap.sitemap" TransformSource="/Bread.xslt"></asp:Xml>

where wsitemap.sitemap is a XML file. if my XSLT get the argument the above code will be able to produce the desired output. so i need c# code for that.

in usercontrol (.cs file) i have :

public static string Transform(string xml, string xsl, XsltArgumentList argsList) 
    { 
        XDocument selectedXml = XDocument.Parse(xml);
        XslCompiledTransform xmlTransform = new XslCompiledTransform();
        StringBuilder htmlOutput = new StringBuilder();
        XmlWriter writer = XmlWriter.Create(htmlOutput);
        xmlTransform.Load(new XmlTextReader(new StringReader(xsl)));
        xmlTransform.Transform(selectedXml.CreateReader(), argsList, writer);
        return htmlOutput.ToString();
    } 
    protected void Page_Load(object sender, EventArgs e)
    {
        string curPageId = Page.Request.Url.AbsoluteUri;
        XsltArgumentList xslArgs = new XsltArgumentList();
        xslArgs.AddParam("curPage", "", curPageId);
        string output=Transform("wsitemap.sitemap","bread.xslt",xslArgs);
        Response.Clear(); Response.Write(output);
    }

but this code is not working , any other approach plz tell me

  • 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-05T13:56:40+00:00Added an answer on June 5, 2026 at 1:56 pm

    You have use , XsltArgumentList C# class to pass arguments. You can add all your parameters there and pass to the xsl.

    Please look into following SO Link,

    Passing parameters to XSLT Stylesheet via .NET

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

Sidebar

Related Questions

I have an asp.net user control on which I want to use jquery ajax.
i have user control, which i render on several views. i want to show
I have asp:DropDownList control which i want to display data to user who don't
I have a user control which I want to define as a template in
I have a user control which is being loaded to the page dynamically after
I have a simple user control which I want to create dynamically every time
I have aspx website in which I have multiple user controls. I want to
I have a user control which displays the currently logged in user's name. I
I have a user control which uses objects as inner properties (some code is
I have a user control which is 2 RadCombos cascaded. I'm trying to add

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.