You would need to do a little modification to the above script. basically just put in a test to see if the letter variable is passed. If its not just get to apply the template to all books. My XSLT is a little rusty as I havent written any in about 2 years but I think it should look a little like this.
Filter nodes on value in nodename
Hi!
Is it possible to show all the nodes starting with a certain letter?
I have a list of books in Umbraco, and when a user clicks on the A. I only want to show the books starting with an A.
Thanks in advance for any hint or help.
Rik
Hi Rik,
You can use the
starts-with()
function for that - if you create a list like this where you link each letter to itself:Then you can grab the letter from the QueryString and show all the books starting with that letter, using something like this:
Note that you'll have to substitute the actual DocumentType aliases for Books and Book documents where they're used in the above code.
/Chriztian
Tnx Chriztian. This will do the trick!
If you wanted to have a 'show all' button for this function - how could this be done?
Thanks
Yep totally can.
You would need to do a little modification to the above script. basically just put in a test to see if the letter variable is passed. If its not just get to apply the template to all books. My XSLT is a little rusty as I havent written any in about 2 years but I think it should look a little like this.
Then all you need is a link to the page without any querystring param.
is working on a reply...