Jump to content

Calling a template from a link click


tinygem

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...