using xslt to sort xml via onclick function

twillaMag

New Member
I would like to know the simplest way to sort an xml/xslt table by clicking associated buttons. I'm pretty familiar with xslt but very new to javascript so go easy on me.I've looked at many examples on the internet but it seems like nothing really fits what I'm trying to do or perhaps my coding skills just aren't up to par.I might be way off but I was thinking something along the lines of...xslt:\[code\]<button onclick="title()">sort by title</button><!--some xsl code--><xsl:for each select="record"><xsl:sort id="title" select="dates/year"/><!--more xsl code-->\[/code\]javascript:\[code\]function title() {document.getElementById(title).select="titles/title";}\[/code\]I'm also not exactly clear on where to put the javascript code. I've already got a .js file that displays my xml & xsl files as an html. Can I put this code there? Or do I need inline script on my xsl file? I've seen many ways of attaching javascript to an xsl file, but I'm not sure which way is best for my purposes
 
Back
Top