Topic: having problems passing parameters to xsl stylesheet from jsp pages (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=27034" title="Pages that link to Topic: having problems passing parameters to xsl stylesheet from jsp pages (Page 1 of 1)" rel="nofollow" >Topic: having problems passing parameters to xsl stylesheet from jsp pages <span class="small">(Page 1 of 1)</span>\

 
zzqproject
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Nov 2005

posted posted 11-21-2005 23:48

hi, i would like my javascript in jsp pass a parameter value to an xsl stylesheet, all looks ok but just doesnt work. the page displays nothing.
here is the javascript
+++++++++++++++++++++++
<script type="text/javascript">// Load XML
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load("msg.xml");
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM");
xsl.async = false;
xsl.load("sort.xsl");
// Transform
var template = new ActiveXObject("MSXML2.XSLTemplate");
template.stylesheet = xsl;
val processor = template.createProcessor();
processor.input = xml;

processor.addParameter("sortKey", "author");

processor.transform();

//document.open();
//document.write(processor.output);
//document.close();

document.write(xml.transformNode(xsl));</script>
++++++++++++++++++

and the xsl file

+++++++++++++++++
............
<xsl:for-each select="messageboard/message">
<xsl:sort select="$sortKey" order="ascending"/>
<li>
<a>
<xsl:attribute name="href">display.jsp?msgid=<xsl:value-of select="@id"/></xsl:attribute>
<xsl:value-of select="subject"/>
................
+++++++++++++++++

any help pls?thanks

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 11-22-2005 01:07

Add <xslaram name="sortKey"/> somewhere after you declair your <xsl:stylesheet>, you need a hook into the param from the xslt file before you can use it.

Dan @ Code Town

zzqproject
Obsessive-Compulsive (I) Inmate

From:
Insane since: Nov 2005

posted posted 11-22-2005 01:13

thanks already sorted!



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu