Each product is categorised using the multi-node tree picker data type, using sub-categories as the permitted MNTP nodes. So, for example, 'Product 1' belongs to 'Sub-category 2' and 'Sub-category 3'.
However, on the website there is a category-level page (http://www.example.com/categories/category-1/) which needs to show all products belonging to any sub-category in this category.
Would any of the XSLT gurus be able to suggest an XPath query to do this? It's beyond me!
(I realise it would be simple if the MNTP was set such that the products were tagged by both category and sub-category but that's a lot of extra work at this stage [1000s of products] and would rely on the customer remembering to tag both category and sub-category, which doesn't seem like the best idea.)
Get all nodes of multi-node tree picker parent
Hi,
Here's the kind of structure I'm working with:
- Categories
- - Category 1
- - - Sub-category 1
- - - Sub-category 2
- - - Sub-category 3
- - Category 2
- - - Sub-category 4
- - - Sub-category 5
- - - Sub-category 6
...etc
- Products
- - Product 1
- - Product 2
- - Product 3
...etc
Each product is categorised using the multi-node tree picker data type, using sub-categories as the permitted MNTP nodes. So, for example, 'Product 1' belongs to 'Sub-category 2' and 'Sub-category 3'.
However, on the website there is a category-level page (http://www.example.com/categories/category-1/) which needs to show all products belonging to any sub-category in this category.
Would any of the XSLT gurus be able to suggest an XPath query to do this? It's beyond me!
(I realise it would be simple if the MNTP was set such that the products were tagged by both category and sub-category but that's a lot of extra work at this stage [1000s of products] and would rely on the customer remembering to tag both category and sub-category, which doesn't seem like the best idea.)
Thanks for any points folks...
Hi Dan,
Off the top of my head, something like this:
$siteRoot being something like $currentPage/ancestor-or-self::*[@level = 1]
Product and SubCategory being DocumentType aliases and subcategory the alias of the MNTP picker property
/Chriztian
This is one of those times when XSLT/XPath proves to be so powerful - thanks Chriztian, that's brilliant, works perfectly!
is working on a reply...