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

  • Home
  • SEARCH
  • 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 7646947
In Process

The Archive Base Latest Questions

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

My issue is regarding rendering on client that uses xsl. This already works in

  • 0

My issue is regarding rendering on client that uses xsl. This already works in IE but I want to make it work on firefox

First, the stylesheet (variablexsl.xsl) The only thing special here is the existence of

<xsl:variable name="module" select="string('RES')"/>

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:variable name="module" select="string('RES')"/>
        <table cellpadding="0" cellspacing="0" border="0" ID="randomID">
            <tr>
                <xsl:choose>
                    <xsl:when test="$module = 'EDU'">
                        <td>EDU was supplied..</td>
                    </xsl:when>
                </xsl:choose>
            </tr>
            <tr>
                <xsl:choose>
                    <xsl:when test="$module = 'RES'">
                        <td>RES was supplied..</td>
                    </xsl:when>
                </xsl:choose>
            </tr>
        </table>
    </xsl:template>
</xsl:stylesheet>

Now, the html file index.html

<html>
<head>
    <script>
        function selectmTab(args) {
            var xml = loadXMLDoc("variabledata.xml"); //ajax call and holds the responseXML. variabledata.xml is empty
            var xsl = loadXMLDoc("variablexsl.xsl");  //ajax call and holds the responseXML
            var ss2 = xsl.selectSingleNode('//xsl:variable/@select');
            ss2.value = "string('" + args + "')";
            document.getElementById("xsltest").innerHTML = xml.transformNode(xsl);
        }
    </script>
</head>
<body onload="displayResult()">
    <div>
    <input type="button" value="EDU" onclick="selectmTab('EDU');" />
    <input type="button" value="RES" onclick="selectmTab('RES');" />
    </div>
    <div id="xsltest"></div>
</body>
</html>

so finally when i click the buttons EDU and RES, the text is getting displayed properly in IE but not in any other browser. I tried to using document.evaluate() but kept getting errors.. and finally turned to SO for help!

Thanks!

Solution:
Making the following changes to the stylesheet, and then using the xsltprocessor().setParameter worked for me.

Changes to the Stylesheet: (Addition of a new xsl:param right after the stylesheet declaration)

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="winnersOnly">RES</xsl:param>

And, then modifying the <xsl:variable> declaration right after <xsl:template match="/"> as follows:

<xsl:template match="/">
<xsl:variable  name="module" select="$winnersOnly"/>

Client Code for firefox

//function loadXMLDoc() makes an ajax request using the XMLHttpRequest object, and returns the responseXML to the caller.

var processor = new XSLTProcessor();
xslholder = loadXMLDoc("styles.xsl");
processor.importStylesheet(xslholder);
processor.setParameter(null, "winnersOnly", "EDU"); //setting the value here
xmlholder = loadXMLDoc("data.xml");
var ownerDocument = document.implementation.createDocument("", "test", null);
var newFragment = processor.transformToFragment(xmlholder, ownerDocument);
document.getElementById("fragment").appendChild(newFragment);
  • 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-31T10:20:27+00:00Added an answer on May 31, 2026 at 10:20 am

    Well XSLT has a well-defined mechanism to pass external parameters to an XSLT stylesheet, namely by putting top level xsl:param elements within the stylesheet to define the name of the external parameters (and also default values if needed) and then by using the XSLT processor’s API to set the parameters before running a transformation.

    For Mozilla, Opera, Safari, Chrome you can use the same API: https://developer.mozilla.org/en/Using_the_Mozilla_JavaScript_interface_to_XSL_Transformations#Setting_parameters.

    For IE which uses MSXML you need to use the corresponding MSXML API: http://msdn.microsoft.com/en-us/library/ms762312%28v=vs.85%29.aspx.

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

Sidebar

Related Questions

I have seen a few posts regarding this issue but not one specific to
I have an issue regarding style my blog. I want to make the header
I have an issue regarding Sendkeys Class, as i want to use this class
I have an issue regarding an recursive count which works well in SQL server,
I'm currently using the jQuery fullcalendar plugin but I've came across an issue regarding
I know there are several threads and posts regarding this issue in the internet
This is an issue that recently came up for me while writing a new
I recently posted an issue regarding unpredictable hover on points in Highcharts, but the
I have a performance issue regarding a quite simple query that run for more
I am 100% new to Python I am bumping into this weird issue regarding

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.