This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How do I pass variables into XSL in HTML(JS) to modify results? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How do I pass variables into XSL in HTML(JS) to modify results?" Watch "How do I pass variables into XSL in HTML(JS) to modify results?" New topic
Author

How do I pass variables into XSL in HTML(JS) to modify results?

SohJai
Greenhorn

Joined: Aug 01, 2001
Posts: 2
How can I pass a variable into XSL in this case to give a different result for the user?
And if I am able to pass a variable in to XSL, how do I read it from XSL?
in my HTML I have this and a <select> where the user can select what he would like to filter out. When item is chosen the 'filter()' runs and I want to make it run the right filter in xsl to output the new Data. How would I go about doin this?
<span id=data></span>
<script>
function filter(){
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load ("XML.xml")
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load ("XSL.xsl")
data.innerHTML = xml.transformNode(xsl)
}
</script>

Thanks in Advance!
SohJi
Sumedh
Greenhorn

Joined: Aug 02, 2001
Posts: 3
>How can I pass a variable into XSL in this case to give a
>different result for the user?
Use 'addParameter' method. This will add a parameter into your XSL stylesheet.
>And if I am able to pass a variable in to XSL, how do I read it
>from XSL?
Define a parameter <xsl aram name="filter"> in your xsl stylesheet.
For more information on the 'addParameter' method: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmmthaddparameter.asp
For addnl. info. on setting and reading parameters: http://www.xml.com/pub/a/2001/02/07/trxml9.html?page=2
-Sumedh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I pass variables into XSL in HTML(JS) to modify results?
 
Similar Threads
Converting an XML document to HTML using Javascript and HTML
How to convert XML file to an HTML file using XSLT
XSL on the Client
Use different XSL files on the same XML doc
Representing an xml