Note that there are some explanatory texts on larger screens.

plurals
  1. POSitecore XPath syntax for the ancestor just below root?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4341216/how-to-find-ancestor-or-self-that-is-a-child-of-an-element-with-particular-attri">How to find ancestor-or-self that is a child of an element with particular attribute?</a> </p> </blockquote> <p>How do you select the ancestor just one level below Home? Say the current node is Home/<strong>News</strong>/moreType/2010/09/NewsItem1, and I want to get <strong>News</strong>. ( Under Home there can be landing section page like News or other type of nodes like common Folder) So far I've tried - <strong>ran the queries in XPath Builder, with context node set to NewsItem1</strong> :</p> <ul> <li><p><code>ancestor::*[position() = last() - 1]</code> syntax error, although <code>ancestor::*[last()]</code> does seem to return Home</p></li> <li><p><code>ancestor::*[@@parentid='{home guid}']</code> having issue with @@parentid see my <a href="https://stackoverflow.com/questions/12719704/does-parentid-attribute-work-in-sitecore-query">other question and comment</a></p></li> <li><p><code>(ancestor::*[position() &lt; last()])[last()]</code> syntax error</p></li> </ul> <p>The problem I'm trying to solve is: locate the landing section parent of any "page" under Home, for highlighting navigation menu purpose. I've referenced <a href="http://sdn.sitecore.net/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.aspx" rel="nofollow noreferrer">Sitecore Query Syntax</a>(and learned some interesting query details, like <code>/ancestor-or-self::*[@#More Criteria Field#!='']/.[1]</code> actually works), but I'm stuck here. </p> <p>Thanks for your time and inputs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload