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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:31:29+00:00 2026-05-26T07:31:29+00:00

I am stuck in firstly creating a simple xslt. stylesheet to use for transforming

  • 0

I am stuck in firstly creating a simple xslt. stylesheet to use for transforming an xml object.Secondly I am stuck in actually using the xslt stylesheet to do the transformation.

The background is the following:

I have a web part which is essentially a small form that has three inputs. These inputs then get submitted and used to query an external API by Http GET request. The results of the query then are displayed on a separate page in XML format. What I now need is to transform the xml to html and output that instead of the XML.

What I currently have:

I have a string variable “tmp” that holds the results from an api query by http get request. The results of the query get stored in the variable and I am able to display the results using: (Code given are small snippets of the whole code which are the most relevant for this particular case)

StreamReader reader = new StreamReader(response.GetResponseStream());
string tmp = reader.ReadToEnd();

Response.Write(tmp);
Response.End();

I then use “tmp” as an XML document object like so:

XmlDocument doc = new XmlDocument();
doc.Load(tmp);

To my project I then added an xslt file that will be used for the transformation.

Here is where I am stuck:

  1. I have created the XML document object as listed above. How do I then proceed to use the XSLT file I have added to my project to do the transformation?

  2. How do I actually achieve the transformation to have the output transformed to HTML.

I have been struggling with this for the best part of a week now.

  • 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-26T07:31:29+00:00Added an answer on May 26, 2026 at 7:31 am

    Here’s a simple example of how to use XSLT to transform XML into HTML:

    string tmp = "<XML DATA>";
    StringBuilder sbXslOutput = new StringBuilder();   
    
    using (XmlWriter xslWriter = XmlWriter.Create(sbXslOutput))  
    {  
        XslCompiledTransform transformer = new XslCompiledTransform();  
        transformer.Load("transformer.xsl");  
        XsltArgumentList args = new XsltArgumentList();  
    
        XmlDataDocument doc = new XmlDataDocument();
        doc.Loadxml(tmp);
    
        transformer.Transform(doc, args, xslWriter);  
    }  
    
    string dataSetHtml = sbXslOutput.ToString();  
    

    Let’s say this is your XML:

    <RecentMatter>   
      <UserLogin>PSLTP6\RJK</UserLogin>   
      <MatterNumber>99999-2302</MatterNumber>   
      <ClientName>Test Matters</ClientName>   
      <MatterName>DP Test Matter</MatterName>   
      <ClientCode>99999</ClientCode>   
      <OfficeCode/>   
      <OfficeName/>   
      <Billable>true</Billable>   
      <ReferenceId/>   
      <LastUsed>2011-08-23T23:40:24.13+01:00</LastUsed>   
    </RecentMatter>   
    <RecentMatter>   
      <UserLogin>PSLTP6\RJK</UserLogin>   
      <MatterNumber>999991.0002</MatterNumber>   
      <ClientName>Lathe 1</ClientName>   
      <MatterName>LW Test 2</MatterName>   
      <ClientCode/>   
      <OfficeCode/>   
      <OfficeName/>   
      <Billable>true</Billable>   
      <ReferenceId/>   
      <LastUsed>2011-07-12T16:57:27.173+01:00</LastUsed>   
    </RecentMatter>   
    <RecentMatter>   
      <UserLogin>PSLTP6\RJK</UserLogin>   
      <MatterNumber>999991-0001</MatterNumber>   
      <ClientName>Lathe 1</ClientName>   
      <MatterName>LW Test 1</MatterName>   
      <ClientCode/>   
      <OfficeCode/>   
      <OfficeName/>   
      <Billable>false</Billable>   
      <ReferenceId/>   
      <LastUsed>2011-07-12T01:59:06.887+01:00</LastUsed>   
    </RecentMatter>   
    </NewDataSet>   
    

    Here’s an XSLT script that transforms the XML to HTML:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">  
      <xsl:template match="/">  
          <table border="1">  
            <tr>  
              <th>User Login</th>  
              <th>Matter Number</th>  
              ...  
            </tr>  
            <xsl:for-each select="NewDataSet/RecentMatter">  
              <tr>  
                <td>  
                  <xsl:value-of select="UserLogin"/>  
                </td>  
                <td>  
                  <xsl:value-of select="MatterNumber"/>  
                </td>  
                ...  
              </tr>  
            </xsl:for-each>  
          </table>  
      </xsl:template>  
    </xsl:stylesheet> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I stuck while trying to compile qpid c++ with boost 1_47_0 using Visual Studio
I'm halfway to getting this correct, but i am currently stuck. Firstly i would
I'm stuck on these three things. Firstly, I'd like to limit invitation count depending
Firstly - Z is Up in this problem. Context: Top down 2D Game using
Firstly just a big Thanks to everyone on this site, I am using it
I think my title basically describes what I stuck at now in XSLT.But to
Stuck here trying to initialize an array (c#) using a loop. The number of
Stuck trying to figure out the best algorithm here. I have this simple function
Kinda stuck here... I have an application with lets say 5000 rows of data
I stuck with problem of mail application , i am developing a website for

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.