...to select all nodes of a certain type. However, what is happening as you can imagine is that it is returning all nodes of type BlogCategory from under ALL the separate sites / root nodes. How can I select all nodes of this type WHOSE ROOT node has a certain property, for example, [language = 'DE'] or whatever, or even better, without specifying a property value. I just want to stay in the current set of nodes, the current 'site', and not branch out and over everything.
It's probably best to walk up to the root of your "current site" instead of getting all the XML. You could do:
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::Site [@isDoc]"/> <!-- (replace Site with the doctype alias of your site's root node) --> <xsl:variable name="blogCategories" select="$siteRoot//BlogCategory [@isDoc][not(umbracoNaviHide) = 1]" />
Also as a side note, using //BlogCategory probably isn't very efficient as its searching through every single descendant node. It's much better if you know where these will be to provide a more specific query, such as
Multiple Root Nodes: How to Select Nodes Under ONLY Current Root
Hi--
I've got a multilanguage site with multiple root nodes, but in several places in my XSLT I am using something like this:
umbraco.library:GetXmlAll()//BlogCategory[not(umbracoNaviHide = 1)]
...to select all nodes of a certain type. However, what is happening as you can imagine is that it is returning all nodes of type BlogCategory from under ALL the separate sites / root nodes. How can I select all nodes of this type WHOSE ROOT node has a certain property, for example, [language = 'DE'] or whatever, or even better, without specifying a property value. I just want to stay in the current set of nodes, the current 'site', and not branch out and over everything.
Help?
Thanks in advance,
Garrett
Hi Garrett,
It's probably best to walk up to the root of your "current site" instead of getting all the XML. You could do:
Also as a side note, using //BlogCategory probably isn't very efficient as its searching through every single descendant node. It's much better if you know where these will be to provide a more specific query, such as
Hope this helps,
Tom
That was great advice -- thanks a lot, Tom!
//Garrett
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.