I wonder if there is an easy way to chose "parent or self", to make this work whether the currentpage is the folder containing textpages or the currentpage is one of the textpages? As now it only works if you are on a textpage.
The level could also be tested and returned to the variable, but I cant seem to get the selector right.
<xsl:choose> <xsl:when test="$currentPage/@level = 2"> <xsl:value-of select = id of currentpage/textpage /> </xsl:when> <xsl:otherwise> <xsl:value-of select = select the parent folder/textpage /> </xsl:otherwise> </xsl:choose>
It's called ancestor-or-self:: and will select all "parents" of currentPage as well as currentPage itself, but you can just include the level predicate to always select the node in the tree that's on level 2, whether it's currentPage or its parent:
I have just finished my examns in C - think my next project will be learning XSLT more in-depth. I have a feeling that the time will be well-spent ;) I did in fact play around with the ancestor-or-self axis, but I dont think I've got the syntax just right :/
Parent-or-self?
Hi.
I have a sub-navigation menu in a sidebar which shows all children of the parent doctype.
It is selected through this variable:
I wonder if there is an easy way to chose "parent or self", to make this work whether the currentpage is the folder containing textpages or the currentpage is one of the textpages? As now it only works if you are on a textpage.
The level could also be tested and returned to the variable, but I cant seem to get the selector right.
Thanks for your help :-)
Hi Stefan,
You're actually very close :-)
It's called ancestor-or-self:: and will select all "parents" of currentPage as well as currentPage itself, but you can just include the level predicate to always select the node in the tree that's on level 2, whether it's currentPage or its parent:
<xsl:variable name="items" select="$currentPage/ancestor-or-self::*[@level = 2]/textpage" />
/Chriztian
Thank you for your help!
I have just finished my examns in C - think my next project will be learning XSLT more in-depth. I have a feeling that the time will be well-spent ;)
I did in fact play around with the ancestor-or-self axis, but I dont think I've got the syntax just right :/
is working on a reply...