Using script.aculo.us with XSLT

December 28, 2006

When using script.aculo.us with XSLT (XML to XHTML), don’t include like this:

<script src="javascripts/scriptaculous.js" type="text/javascript">

This is because scriptaculous.js uses document.write () to include the components and that’ apparently verboten when using XSL. The symptoms are weird too: * Safari will acts as if all was OK, except Ajax.Request won’t work * Firefox/Gecko-based browsers will just hang on loading the document (an invinite “Reading”) and you’ll notice some class name related errors in the JS log. In other words, the correct way to include, is by all the files separately and in the right order:

<script src="javascripts/effects.js" type="text/javascript"></script>

<script src="javascripts/builder.js" type="text/javascript"></script>

<script src="javascripts/dragdrop.js" type="text/javascript"></script>

...