[Home] [By Thread] [By Date] [Recent Entries]
Hi Alan,
My question for this list is: Is there a simpler way than what I am doing now to narrow down the events I want to use? It works just fine, but it took a lot of setup.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="calendar-style" select="'by-month'" /> <xsl:param name="band" /> <xsl:param name="month" /> ... </xsl:stylesheet> then you can pass values for those parameters into the stylesheet prior to the transformation. What I'd do is have the 'submit' button invoke a function that set the stylesheet parameters based on the values in the list boxes, and then performed the transformation, loading the result into a portion of your page (a <div>). In Sarissa, it's something like the following (completely untested and partially pseudo- code): function reloadCalendar() {
// Set the processor parameters based on the values given in the form
processor.setParameter(null, 'calendar-style', form.calendarStyle);
if (form.calendarStyle == 'by-band') {
processor.setParameter(null, 'band', form.name);
} else {
processor.setParameter(null, 'month', form.name);
}// Transform the XML to produce an HTML calendar htmlCalendar = processor.transformToDocument(xmlCalendar); // Replace the existing calendar with the new one
calendarDiv.innerHTML =
new XMLSerializer.serializeToString(htmlCalendar);
}The above function relies on a global 'processor' variable that is an XSLTProcessor with your parameterised stylesheet imported, and a global 'xmlCalendar' variable that holds the DOMDocument representing the XML source document. These each only need to be set once, and can be reused again and again, which should make your whole application that much quicker. I hope that gives you enough pointers. Cheers, Jeni -- Jeni Tennison http://www.jenitennison.com
|

Cart



