[xsl] RE:22523

Subject: [xsl] RE:22523
From: "daniel g" <dgale_@xxxxxxxxxxx>
Date: Fri, 11 Nov 2005 19:47:25 -0500
I am new to this list but am replying to 22523.
I posted it trying to find out how to change a parameter via a hyper link. I found a great website that helped me out. I have it working the way I want. I ended up splitting the project into 3 files. 1: XML 2: XSL 3: HTML . Basically I took the html out of the XSL file and made the letter param global by putting it at the top of the file. I then put this script in the html file.
<script language="javascript">


var g_letter;

function setLinkValue(clicked){
g_letter = (!clicked)?"":clicked;
pickBrowser();
}
function pickBrowser(){
var moz = (typeof document.implementation != 'undefined') &&
(typeof document.implementation.createDocument != 'undefined');
if (moz){
Load_Mozilla();
}
else{
Load_IE();
}
}


//IE scripting
function Load_IE(){
   xmlDoc = new ActiveXObject( "MSXML2.DOMDocument.3.0" );
   xslDoc = new ActiveXObject( "MSXML2.FreeThreadedDOMDocument.3.0" );
   var xslTemplate = new ActiveXObject( "MSXML2.XSLTemplate.3.0" );

   //Load in the raw XML data:
   xmlDoc.async = "false";
   xmlDoc.load( 'pass.xml' );

   //Load in the XSLT transform script:
   xslDoc.async = "false";
   xslDoc.load( 'pass.xsl' );

   xslTemplate.stylesheet = xslDoc;
   xslProcessor = xslTemplate.createProcessor( );
   xslProcessor.input = xmlDoc;

   //Overwrite the xsl:params with runtime selected values:
   xslProcessor.addParameter( "letter",        g_letter );

   //Output the XML (as processed by the XSLT) to the div target
   xslProcessor.transform();
   putTablesHere.innerHTML = xslProcessor.output;
}

//Mozilla scripting
function Load_Mozilla(){

   //Load in the raw XML data:
   xmlDoc = document.implementation.createDocument("", "", null);
   xmlDoc.load( 'pass.xml' );
   xmlDoc.onload = readXML;
}

function readXML(){

   xslDoc = document.implementation.createDocument("", "test", null);
   xslProcessor = new XSLTProcessor();

   //Load in the XSLT transform script:
   xslDoc.addEventListener("load", xslLoad, false);
   xslDoc.load( 'pass.xsl' );
}

function xslLoad(){
   xslProcessor.importStylesheet( xslDoc );

   //Overwrite the xsl:params with runtime selected values:
   xslProcessor.setParameter( "", "letter",     g_letter );

//Output the XML (as processed by the XSLT) to the div target
xmlOutput = xslProcessor.transformToDocument( xmlDoc );
var xmlSerializer = new XMLSerializer();
putTablesHere.innerHTML = xmlSerializer.serializeToString( xmlOutput );
}
</script>
I called the setLinkValue from the body onLoad attribute and I made a div in the page to post everything it's called, putTablesHere. Anyway.. props to the site that helped and here is their page http://www.gamedev.net/reference/programming/features/xmltech/page4.asp
Thanks for letting me post.
-daniel.


Current Thread