Get Childnodes of Defined parent if you are on parent node
I have the code below which prints the childnodes of whichever parent node i am under. Is there a way to only print something if i am under a certain node.
Basically like "If currentNode = 1122 then print children, otherwise do nothing" I'm not that experienced with XSLT and could really use some help!
That worked great. Is it possible now to define something like below, what's happening now is that when I actually end up on one of the children, it hides the navigation. I didn't even think about that when i posted my question before.
<xsl:if test="$currentPage/@id = 1122" or child of 1122> </xsl:if>
he first thing that comes to mind is that you proably want to avoid hard-coding Id's in your code (XSLT or .NET). It sounds like you have a context-sensitive nav that basically just shows the children of the current parent in your master template? If that is the case, then you should look at doing the following:
This should give you the children of the current pages parent (inlcuding itself). If I am not understanding you correctly, please let me know. Also it would be helpful to get complete code that you currently have.
Guys, thank you for your help. What i ended up doing was using skiltz code but using a Macro parameter to determine the id, seems to be working great. Basically my problem was that my navigation was complicated enough style-wise that I wanted to hard-code the top-level, but still wanted the scalability of a dymanically-created sub-navigation, this is working very nicely so far.
Get Childnodes of Defined parent if you are on parent node
I have the code below which prints the childnodes of whichever parent node i am under. Is there a way to only print something if i am under a certain node.
Basically like "If currentNode = 1122 then print children, otherwise do nothing" I'm not that experienced with XSLT and could really use some help!
somehting like:
<xsl:if test="$currentPage/@id = 1122">
</xsl:if>
Yes! Thank you!
That worked great. Is it possible now to define something like below, what's happening now is that when I actually end up on one of the children, it hides the navigation. I didn't even think about that when i posted my question before.
he first thing that comes to mind is that you proably want to avoid hard-coding Id's in your code (XSLT or .NET). It sounds like you have a context-sensitive nav that basically just shows the children of the current parent in your master template? If that is the case, then you should look at doing the following:
This should give you the children of the current pages parent (inlcuding itself). If I am not understanding you correctly, please let me know. Also it would be helpful to get complete code that you currently have.
Cheers.
<xsl:if test="$currentPage/ancestor-or-self::node/@id = 1122">
</xsl:if>
Guys, thank you for your help. What i ended up doing was using skiltz code but using a Macro parameter to determine the id, seems to be working great. Basically my problem was that my navigation was complicated enough style-wise that I wanted to hard-code the top-level, but still wanted the scalability of a dymanically-created sub-navigation, this is working very nicely so far.
is working on a reply...