I'm working on a blog style website at the moment, on the front page I want to be able to filter the content depending on category. (a defined field on the doctype).
You'll see when the querystring 'All' is passed, it displays all the content, and then if you click one of the filters it only shows content from the relevant category.
Aha!! an hour of banging my head against a wall, and even considering using //*[name()='$yourvalue'] suddenly it all made sense, and I relised I'd completly missread how the contains function works...
The only problem left now is when you have a category "car" and "carrot", that both will show up when querying on "car". But maybe that's a little too far here ;)
Filtering Content
I'm working on a blog style website at the moment, on the front page I want to be able to filter the content depending on category. (a defined field on the doctype).
If you go to http://wearearchitects.co.uk/default.aspx?filter=All
You'll see when the querystring 'All' is passed, it displays all the content, and then if you click one of the filters it only shows content from the relevant category.
This is done using this code...
[code]
Hi Laurence,
I think the XPath contains function should come in handy. You could use it to search for your category inside the concatenated string.
Cheers,
Ruben
Aha!! an hour of banging my head against a wall, and even considering using //*[name()='$yourvalue'] suddenly it all made sense, and I relised I'd completly missread how the contains function works...
Now the code looks like...
[code]
Hehe :)
The only problem left now is when you have a category "car" and "carrot", that both will show up when querying on "car". But maybe that's a little too far here ;)
Ah a very good point! I'll remember to bear that in mind, thanks again for your help!
No doubt you'll see this project develop over the next few days, L
is working on a reply...