Get properties from parent pages with separator in between
I have this snippet of code from the Get Meta Tags package, which is working great. For the title tag, I'd like it to traverse up and get all of the title tags of the pages above it, except the homepage and put a separator in between (| or - or :). I get how to look down from the current page, but am having trouble finding out how to go up and then ignore the top level...So the desired output would be like this: Current Page - Parent Page - Site Title
Any help would be appreciated!
<title><xsl:for-each select="$currentPage/ancestor-or-self::node[not(string(./data [@alias = 'title'])='')]"> <xsl:sort select="position()" data-type="number" order="descending"/> <xsl:if test="position()=1"> <xsl:value-of select="./data [@alias = 'title']" /> - Site Title Here </xsl:if> </xsl:for-each> </title>
Hmm, That seems to just return the current node, also it returns nothing on the top node. I didn't realize before that it should show the top node title only when its the current page.
Hmm, That seems to just return the current node, also it returns nothing on the top node. I didn't realize before that it should show the top node title only when its the current page.
Actually that code on traverses up and shows the parent if the current page has children it seems? Something funny is going on with it, it almost seems to be arbitrarily showing the parents title field.
Get properties from parent pages with separator in between
I have this snippet of code from the Get Meta Tags package, which is working great. For the title tag, I'd like it to traverse up and get all of the title tags of the pages above it, except the homepage and put a separator in between (| or - or :). I get how to look down from the current page, but am having trouble finding out how to go up and then ignore the top level...So the desired output would be like this: Current Page - Parent Page - Site Title
Any help would be appreciated!
With
you get all parent nodes starting with the current node but ending with the node on level 2 (">" = "greater than"). See http://umbraco.org/documentation/books/xslt-basics/xpath-axes-and-their-shortcuts
hth, Thomas
Hmm, That seems to just return the current node, also it returns nothing on the top node. I didn't realize before that it should show the top node title only when its the current page.
Hmm, That seems to just return the current node, also it returns nothing on the top node. I didn't realize before that it should show the top node title only when its the current page.
Actually that code on traverses up and shows the parent if the current page has children it seems? Something funny is going on with it, it almost seems to be arbitrarily showing the parents title field.
is working on a reply...