<!-- Using XPath -->
<xsl:variable name="node1" select="$currentPage/ancestor::root//*[@id = 1234]" />
<!-- Using extension library -->
<xsl:variable name="node2" select="umbraco.library:GetXmlNodeById(1234)" />
Using XPath you can trim down the amount of nodes searched by adding anything you know about the location of the node your'e looking for, e.g.:
<!-- Reference to root of site -->
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
<!-- I want a NewsItem node that is a direct child node of the News node that is at the root of the site -->
<xsl:variable name="breakingNews" select="$siteRoot/News/NewsItem[@id = 1234]" />
- ok, misread the question (mislead by the title, I guess :-)
Yes, if you know the startnode you could just do what you did - should work fine - maybe use the DocumentType's name if you know it, e.g. NewsItem instead of the generic *[@isDoc]
new syntax find a node with a specific id..
hi guys I'm trying to work out under the new syntax how to find the children starting at a specific node id..
i.e. root/* [@id = $startNodeID and @isDoc]/* [@isDoc] ??? would that be the most correct way to find them?
Hi Tom,
To find a node by ID you can do either of these:
Using XPath you can trim down the amount of nodes searched by adding anything you know about the location of the node your'e looking for, e.g.:
/Chriztian
- ok, misread the question (mislead by the title, I guess :-)
Yes, if you know the startnode you could just do what you did - should work fine - maybe use the DocumentType's name if you know it, e.g. NewsItem instead of the generic *[@isDoc]
/Chriztian
is working on a reply...