Use umbraco.library:GetXmlAll() instead of $currentPage like this:
<xsl:for-eachselect="umbraco.library:GetXmlAll()//umbNewsArea/umbNewsArticle [@isDoc and string(umbracoNaviHide) != '1']">
Note also the usage of '//' instead of '/' before 'umbNewsArea' in the snippet above - it will make XPath select all 'umbNewsArea' nodes notwithstanding the level.
I'd recommend a simple XPath based off $currentPage for this - the GetXmlAll() extension really doesn't make much sense inside of XSLT - calling an extension function to fetch *everything* once more always seemed overkill to me - $currentPage *has* everything already (but I aknowledge that from a C# developer's viewpoint, it may be more transparent what it does...)
Getting the website root in xslt
Im using the umbBusiness Site which has umbBusinessFrontpageNews.xslt
I want to thave the news list appear in the sidebar of every page but the xslt page uses the following code
<xsl:for-each select="$currentPage/umbNewsArea/umbNewsArticle [@isDoc and string(umbracoNaviHide) != '1']">
So that I only get a list of the news articles on the homepage what can I replace
$currentPage with to navigate to the homepage of the site?
Use umbraco.library:GetXmlAll() instead of $currentPage like this:
<xsl:for-each select="umbraco.library:GetXmlAll()//umbNewsArea/umbNewsArticle [@isDoc and string(umbracoNaviHide) != '1']">
Note also the usage of '//' instead of '/' before 'umbNewsArea' in the snippet above - it will make XPath select all 'umbNewsArea' nodes notwithstanding the level.
Thanks alot sending you a virtual beer
Hi rs82uk (and Rodion),
I'd recommend a simple XPath based off $currentPage for this - the GetXmlAll() extension really doesn't make much sense inside of XSLT - calling an extension function to fetch *everything* once more always seemed overkill to me - $currentPage *has* everything already (but I aknowledge that from a C# developer's viewpoint, it may be more transparent what it does...)
Anyway, this is how I usually do this:
Be careful with the double slash, though - if you know where the nodes are, it's much better to address them specifically, e.g.:
- this way, the processor will only search the specified path and not try all levels below to find the umbNewsArea nodes.
/Chriztian
is working on a reply...