Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Laurence Gillian 600 posts 1219 karma points
    Jan 02, 2009 @ 19:22
    Laurence Gillian
    0

    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]


  • Ruben Verborgh 379 posts 30 karma points
    Jan 02, 2009 @ 19:30
    Ruben Verborgh
    0

    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

  • Laurence Gillian 600 posts 1219 karma points
    Jan 02, 2009 @ 21:48
    Laurence Gillian
    0

    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]

  • Ruben Verborgh 379 posts 30 karma points
    Jan 02, 2009 @ 21:50
    Ruben Verborgh
    0

    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 ;)

  • Laurence Gillian 600 posts 1219 karma points
    Jan 02, 2009 @ 22:08
    Laurence Gillian
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft