1

In my XSL i have included a dropdown box which have values like,

one
two
three
four
five

If I select the value "one", then the template "one" should be applied.

<xsl:template match="one">
     <!-- code goes here -->
</xsl:template>

like wise two, three four and five should match their appropriate templates. Is it possible using Javascript, so that onchange() method can get the selected value and call its own template.

If there is any other way, please suggest me.

Thanks, jeyaa

2 Answers 2

3

That's not the way client-side XSLT currently works. The XSLT is executed to generate (HTML + Javascript), and by the time any user interaction occurs, the XSLT has finished its job. I'm trying to change that model with Saxon-CE, but that's in the future.

For the moment, the best that you can do is catch the event in Javascript, and have the Javascript invoke a new XSLT stylesheet transformation.

Sign up to request clarification or add additional context in comments.

Comments

0

Try with an XSLT jQuery plugin like the xslt pack (http://code.google.com/p/jquery-reference/source/browse/trunk/jQueryReference.wdgt/Assets/js/jquery.xslt.pack.js?r=7)

you can then do something like :

$(".myDiv").xslt(xmlData.xml, xslData.xml);

and change the xslData.xml with the xsl stylesheet you want depending on what has been clicked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.