[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML subset selection-a simpler way? (message 27746

Subject: Re: XML subset selection-a simpler way? (message 27746)
From: "Alan Varga" <aevarga@xxxxxx>
Date: Wed, 28 Jun 2006 07:30:02 -0500
sarissa merge xml
If I have declared a processor and I want to pass parameters collected from a form in an HTML page to my XSL stylesheet, isn't it as simple as the example below?

~~~~~ start of Javascript snippet ~~~~~
var sCalType = checkRadio(theForm.grpOptions);
var sSelection = theForm.lstCalendar.value;
var xslStylesheet = "test.xsl";
...
var xslDoc = Sarissa.getDomDocument();
xslDoc.async = false;
xslDoc.load(xslStylesheet);

var processor = new XSLTProcessor();
processor.importStylesheet(xslDoc);
processor.setParameter(null, "type", sCalType);
processor.setParameter(null, "selection", sSelection);
...
function checkRadio(group){
 for (x=0; x<group.length; x++) {
   if (group[x].checked == true) {
     val = group[x].value;
//      alert(val);
   }
 }
 return val;
}
~~~~~ end of Javascript snippet ~~~~~


~~~~~ start of XSL snippet ~~~~~ <xsl:param name="type"/> <xsl:param name="selection"/> ... <xsl:template match="Events"> <tbody> <xsl:choose> <xsl:when test="$type='Month'"> <xsl:apply-templates select="Event[MonthName=$selection]" /> </xsl:when> <xsl:when test="$type='Band'"> <xsl:apply-templates select="Event[Band=$selection]" /> </xsl:when> </xsl:choose> </tbody> </xsl:template> ... ~~~~~ end of XSL snippet ~~~~~

If I use alert(processor.getParameter(null, "type")) the parameter value is null, and the transformation fails because nothing was passed into the XSL stylesheet.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.