I have a macro on the stockists page which picks out all stockists, listing their country then city, then stockist name, then address details. It works great, but I'm trying to add a filter which shows only nodes from a particular country, when the nodeId of the country is passed into the macro XSLT file as a form post variable.
I'm not sure how to get it to pick out just the particular nodes from the given countryId. Do I create something inside the for-each which traverses back to the root node, then forwards by level to the country node and does a comparison, or can I put something inside the main <for-each select> which only selects the correct node to begin with?
List all sub-nodes only where parent nodeId matches
Hi,
I have a structure like this:
- Master home
- - en
- - - stockists
- - - - uk
- - - - - london
- - - - - - shop1
- - - - - - shop2
- - - - - manchester
- - - - - - shop3
- - - - - - shop4
- - - - - bristol
- - - - - - shop5
- - - - - - shop6
- - - - italy
- - - - - rome
- - - - - - shop7
- - - - - milan
- - - - - - shop8
etc.
I have a macro on the stockists page which picks out all stockists, listing their country then city, then stockist name, then address details. It works great, but I'm trying to add a filter which shows only nodes from a particular country, when the nodeId of the country is passed into the macro XSLT file as a form post variable.
The code I have so far is this:
I'm not sure how to get it to pick out just the particular nodes from the given countryId. Do I create something inside the for-each which traverses back to the root node, then forwards by level to the country node and does a comparison, or can I put something inside the main <for-each select> which only selects the correct node to begin with?
Thanks.
Hi Dan
I would go for adding an additional condition to your for-each.
Assuming your currentPage is the "stockist" node, do something like this (out of my head - soo untested)
>Tommy
Thanks Tommy,
I've modified that to this:
It works okay, except that the default for the page is that there is no countryId passed in, in which case it needs to show all country nodes.
The you add an "or"-part
Excellent, thanks Tommy! The final selection is (for the record):
is working on a reply...