Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing Querystring to XSL param

    Hey folks,

    I have this hacked together code from some webpage that works in some versions of IE (but not the latest) and does not work in Firefox, etc.

    I have seen examples of how to make stuff like this cross-browser, but usually the script is doing something different than I am doing, and I don't know enough about Javascript to adapt it.

    Any help?

    Another (but less pressing) issue is setting the value to ZZZ if there is no query string. It works if I do an if/else statement on this line:

    Code:
    processor.addParameter("param1", qrystring);
    But only if it has a query string with no value (?Code=), not if there is nothing at all.

    Code:
    <script type="text/javascript">
    urlstring = location.href;
    qrystring=urlstring.substring(urlstring.indexOf("=") + 1, urlstring.length);
    
    //Passing  XSL variable 
    var xml = new ActiveXObject("MSXML2.DomDocument.4.0");
    xml.async = false;
    xml.load("ReportsForWeb.xml");
    
    var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.4.0");
    xsl.async = false;
    xsl.load("program.xsl");
    
    var template = new ActiveXObject("MSXML2.XSLTemplate.4.0")
    
    template.stylesheet = xsl; 
    processor = template.createProcessor();
    
    processor.input = xml;
    processor.addParameter("param1", qrystring);
    
    processor.transform();
    document.open();
    document.write(processor.output);
    document.close();
    
    </script>
    Last edited by dm00n; 10-07-2010 at 03:38 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •