Quick query/brain picker. I have a list of nodes (1300 in total) and i want to sort them alphabetically and show and hide them by the letter (a user clicks the letter A and only sees the nodes starting with the letter A). What is the best way to sort them and add the div class needed?
Here's something that I have, not sure if it will work for you. The intention in the below was to get a list of locations, and list them by country order. In this case the nodes had a property of "country" that I was sorting by. You'd probably need to truncate a property to be the first character, then use that as headings
Here's a sample stylesheet using Muenchian Grouping (as dandrayne suggested) for grouping the nodes by first-letter (of @nodeName in this sample) and using the generate-id() function to generate unique ids for the nodes.
String manipulation
Hey All,
Quick query/brain picker. I have a list of nodes (1300 in total) and i want to sort them alphabetically and show and hide them by the letter (a user clicks the letter A and only sees the nodes starting with the letter A). What is the best way to sort them and add the div class needed?
Thanks
Alec
For sorting, In xslt 1.0 (...) You'd need to look at something like http://www.jenitennison.com/xslt/grouping/muenchian.html
Here's something that I have, not sure if it will work for you. The intention in the below was to get a list of locations, and list them by country order. In this case the nodes had a property of "country" that I was sorting by. You'd probably need to truncate a property to be the first character, then use that as headings
On another idea, although 1300 nodes is a probably too much for JS, you might want to look at at http://www.ihwy.com/Labs/Demos/Current/jquery-listnav-plugin.aspx
Dan
Hi Alec,
Here's a sample stylesheet using Muenchian Grouping (as dandrayne suggested) for grouping the nodes by first-letter (of @nodeName in this sample) and using the generate-id() function to generate unique ids for the nodes.
Hopefully it gets you on the right track...
/Chriztian
Thanks for that, i havent had time to try it out but ill let you know when i have!
Alec
Thanks for that! Both did the trick!
Alec
is working on a reply...