Copied to clipboard

Flag this post as spam?

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


  • Vishal G.P 62 posts 122 karma points
    Feb 28, 2012 @ 12:06
    Vishal G.P
    0

    Filter with xslt and multinode tree picker challenge

    Hey xslt experts,

    i'm in no way very handy with xslt so here is my challenge..

    I have a page where i have 2 dropdowns which are filters for category and location. They work through the querystring parameter and i get them like this.

     

      <xsl:variable name="category" select="/macro/cat"/>
      <xsl:variable name="location" select="/macro/loc"/>
    

     

    Now i have  vacancy pages below my currentPage. Every Vacancy page has 2 MNTP. One for 'category' and one for 'location'. So cat en loc are Id's. ( querystring example ?cat=1495&loc=0)

    Now i want to loop through all my vacancy Pages (docType is VacancyPage) and return only the set of VacancyPage pages, that match the querystring parameters with the NodeId's from the VacancyPage MNTP's.

    I tried the code below, but i think the MNTP don't loop through multiple NodeId in them or something. In the code below 'functionCategory and loctionCategory are my MNTP properties of the VacancyPage.

     

    <xsl:variable name="results" select="$currentPage/VacancyPage[./functionCategory/MultiNodePicker//nodeId = $category or ./locationCategory/MultiNodePicker//nodeId = $location]"/>

     

    The idea is that i get a node-set of the VacancyPages that match the category and location filters, because i need that on some paging mechanism as well.. 

    Since my xslt isnt that great, i'm thinking of going to c# to do it there with the API and return it back to XSLT.

    But i thought let me try it here, maybe some of you has a better idea how to get this done properly..

    Thanks in Advance...

    Wiske

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Feb 28, 2012 @ 12:21
    Chriztian Steinmeier
    1

    Hi Wiske80,

    I'd try to split them up like this:

    <xsl:variable name="categoryPages" select="$currentPage/VacancyPage[functionCategory//nodeId = $category]" />
    <xsl:variable name="locationPages" select="$currentPage/VacancyPage[locationCategory//nodeId = $location]" />
    
    <!-- Join the pages -->
    <xsl:variable name="result" select="$categoryPages | $locationPages" />

     

    If that doesn't help, you can try to do a separate <xsl:copy-of /> for each variable and see what gets selected ...

    /Chriztian

  • Vishal G.P 62 posts 122 karma points
    Feb 28, 2012 @ 14:48
    Vishal G.P
    0

    thanks Chriztian again for your help... this pointed me in the right direction

     

Please Sign in or register to post replies

Write your reply to:

Draft