PDA

Click to See Complete Forum and Search --> : Add Javascript to Transformed XML


drekab
Dec 15th, 2004, 09:03 AM
I am new to XML and XSLT so I apologize if this question is pretty basic. I have some XML generated on the server that I am then transforming on the client with XSLT. I need the transformed HTML to dynamic HTML however, and I am having difficulty with this. I figured out that I can put the javascript in line on the OnClick event, however because of the size of the results set the HTML is fairly large and there seems to be a real speed issue if I put the entire function in each onclick event (This section of the transform is a drillable table of content, so there is a lot of code in showing and hiding the sections).

So, my question is, how do I add a function to the HTML using only the XSLT? Sorry for the longwinded explaination. Also, I am using IE6 and VID6 to develop.

Thanks in advance.

CornedBee
Dec 15th, 2004, 09:51 AM
Add only a single <script> element that links to an external JavaScript file. This external file can then identify the elements that need behaviours and attach these behaviours to the elements.

Element identification can happen in several ways. One way is to give all these elements a specific class, and in the script, loop through the elements and check for the classes.