Jump to content

Calling a template from a link click


tinygem
 Share

Recommended Posts

Hi all,I'm creating a product search results page in XSLT and I want to be able to sort the product results based on name, price and manufacturer. I've managed to get the sort function working great by creating three templates, but I wanted to know if there is a way a user can click on a link and invoke a new template in the same page, i.e to change the results from being sorted by name to being sorted by price, for instance.Any suggestions welcome!Thanks,Gem

Link to comment
Share on other sites

There was another topic here which explained a similar scenario and desired outcome... actually the exact same - again about sorting.What you need to do is create a parameter with XSLT (using the xsl:param element at the top level), and then apply a different sorting based on the parameter's value (within an xsl:choose element that performs "$parameterName = 'sorting kind').How you adjust the parameter value depends on whether you use XSLT on the client or on the server.If on the client, you need to do it with JavaScript by using a function like the one described in this post but more adapted for your case.If on the server, you can just pass a query string variable on a link, and give the parameter whatever you receive as a value. Note that in this case, the whole page will have to be redownloaded.An ideal approach will be to use JavaScript, falling back to a server side generation when JS is off.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...