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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:16:53+00:00 2026-06-18T04:16:53+00:00

I’m using C# to process an XSLT sheet which uses XML data. On my

  • 0

I’m using C# to process an XSLT sheet which uses XML data.

On my XSLT sheet, I am applying a template which goes through the XML data and is suppose to throw out figures based on the parameters passed through to it.

When I run the XSLT sheet and pass parameters to it, there is no output. The html side of the XSLT seems to run just fine.

Here is my XSLT code :

http://pastebin.com/eL9wnRgK

Here is my XML file :

http://pastebin.com/B3eqbd6K

I am using Visual Studio 2012 to process the above, if we exclude my C# classes that I use to process the xslt, even in the inbuilt XSLT debugger of VS it doesn’t seem to do anything (no data is output).

I’ve spent hours going through but can’t really find out where i’m going wrong and there isn’t any Syntax that is highlighted red or any errors shown. This language is much harder than c#…

  • 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-18T04:16:54+00:00Added an answer on June 18, 2026 at 4:16 am

    Your XSLT was in need of some serious cleanup. Remember to keep in mind the DRY principle. By avoiding the use of repeated parts, I was able to reduce the length of your XSLT by more than 100 lines. Once you figure out how to pass the parameter values correctly, this should work:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
      <!--Search parameter to store the search string entered-->
      <xsl:param name="SearchRecipe" />
      <!--Search type parameter to store the type of search selected-->
      <xsl:param name="SearchType" select="'Start'" />
      <xsl:param name ="IsVegetarian" />
    
      <!--First part of code to capture values from user and then store them 
            in the variables above-->
      <xsl:template match="/">
        <html>
    
          <head>
            <!--Sets Title of Page (within our Master template)-->
            <a>
              <title>Recipe Headquarters</title>
            </a>
            <!--Reference to the stylesheet we are using-->
            <link href="Cafesheet.css" rel="stylesheet" type="text/css" />
          </head>
    
          <body>
            <form  id="banner" name="content" method="get" action="Commercial.aspx">
              <h1 >Recipe Book</h1>
              <div id="content">
                <p>
                  <label id="h2" for="txtFilter">Search Recipe Book </label>
    
                  <input type="text" name="txtFilter" 
                         id="txtFilter" value="{$SearchRecipe}"/>
    
                  <!--Creates a simple submit button-->
                  <input type="submit" name="btnSearch" 
                         id="btnSearch" value="Submit" />
                  <br />
                  <br />
    
    
                  <!--Label of text for our set of radio buttons-->
                  <label for="rdoSearchType">Select a Search Type  </label>
    
                  <!--Behold, the radio buttons themselves-->
                  <xsl:call-template name="SearchTypeRadio">
                    <xsl:with-param name="value" select="'Start'" />
                    <xsl:with-param name="text" select="'Starts with'" />
                  </xsl:call-template>
                  <xsl:call-template name="SearchTypeRadio">
                    <xsl:with-param name="value" select="'Contains'" />
                    <xsl:with-param name="text" select="'Contains'" />
                  </xsl:call-template>
                  <xsl:call-template name="SearchTypeRadio">
                    <xsl:with-param name="value" select="'RecipeType'" />
                    <xsl:with-param name="text" select="'Recipe Type'" />
                  </xsl:call-template>
                  <br />
                  <br />
                  <br />
    
                  <!--Applys the template from the second part-->
                  <xsl:apply-templates 
                    select="CafeRecipes[$SearchType = 'Start' or 
                                        $SearchType = 'Contains' or
                                        $SearchType = 'RecipeType']" />
    
                </p>
                <!--End our of Search input text box and the Type of search 
                       we want to do Div-->
              </div>
    
              <!--Our self closing footer div, yayyyy. Single line madness-->
              <h1>Made by Jagga ^_^</h1>
            </form>
          </body>
        </html>
      </xsl:template>
    
      <xsl:template name="SearchTypeRadio">
        <xsl:param name="value" />
        <xsl:param name="text" />
        <input type="radio" name="rdoSearchType" value="{$value}">
          <xsl:if test="$SearchType = $value">
            <xsl:attribute name="checked">checked</xsl:attribute>
          </xsl:if>
          <xsl:value-of select="$text"/>
        </input>
      </xsl:template>
    
      <!--This will be the second part of the xsl code to manipulate the data 
              based on our chosen values from above-->
      <!--Declares new xsl template-->
      <xsl:template match="CafeRecipes">
        <!--Creates a small table to display the data output produced-->
        <table id="content" border="5">
          <tr>
            <th>Recipe #</th>
            <th>Recipe Name</th>
            <th>Ingredients Required</th>
            <th>Instructions</th>
            <th>Recipe Type</th>
            <th>Vegetarian?</th>
          </tr>
    
          <xsl:variable name="matchedRecipes"
             select="ARecipe[
                   ($SearchType = 'Start' and starts-with(ItemName, $SearchRecipe)) or
                   ($SearchType = 'Contains' and contains(ItemName, $SearchRecipe)) or
                   ($SearchType = 'RecipeType' and 
                                contains(RecipeInfo/RecipeType, $SearchRecipe))
                              ]" />
    
          <xsl:if test="$SearchType = 'Start' or $SearchType = 'Contains'">
            <xsl:apply-templates select="$matchedRecipes">
              <xsl:sort select="RecipeInfo/RecipeType" order="ascending" />
            </xsl:apply-templates>
          </xsl:if>
          <xsl:if test="$SearchType = 'RecipeType'">
            <xsl:apply-templates select="$matchedRecipes">
              <xsl:sort select="ItemName" order="ascending" />
            </xsl:apply-templates>
          </xsl:if>
        </table>
      </xsl:template>
    
      <xsl:template match="ARecipe">
        <tr>
          <xsl:apply-templates select="*[not(*)] | RecipeInfo/*" />
        </tr>
      </xsl:template>
    
      <xsl:template match="ARecipe/* | ARecipe/*/*">
        <td width="300">
          <xsl:apply-templates select="." mode="content" />
        </td>
      </xsl:template>
    
      <xsl:template match="Vegetarian[. = 'Yes']" mode="content">
            YesThisWorks and it's vegetarian
      </xsl:template>
    
      <xsl:template match="Vegetarian[. = 'No']" mode="content">
        YesThisWorks and it's NOT vegetarian
      </xsl:template>
    </xsl:stylesheet>
    

    The only call to AddParameter() I see in your ASPX code is MyXMLConduit.AddParameter("TheFilter", AFilter);. Since the name of your parameter in the XSLT is “SearchRecipe”, you need to use that as the parameter name, not “TheFilter”. You also need to get the value of the rdoSearchType query parameter and add that as one of the XSLT’s parameters.

    string searchType = Request["rdoSearchType"];
    if(searchType != null)
    {
        MyXMLConduit.AddParameter("SearchType", searchType);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I am using jsonparser to parse data and images obtained from json response. When
I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
Specifically, suppose I start with the string string =hello \'i am \' me And
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only

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.