Velocity version of following-sibling and preceding-sibling
Hello,
I am trying to create two buttons on a page that link to the Previous and Next page in a of the current page in an index using velocity.
With XSLT I use to be able to do this using code like the following
<xsl:when test="@current='true'">
<xsl:if test="following-sibling::system-folder[1]">
<a class="toolnav" style="float:right;"><xsl:attribute name="href">[system-asset]<xsl:value-of select="following-sibling::system-folder[1]/path"/>/index[/system-asset]</xsl:attribute>Next</a>
</xsl:if>
<xsl:if test="preceding-sibling::system-folder[1]">
<a class="toolnav" style="float:right;"><xsl:attribute name="href">[system-asset]<xsl:value-of select="preceding-sibling::system-folder[1]/path"/>/index[/system-asset]</xsl:attribute>Previous</a>
</xsl:if>
</xsl:when>
Could someone point me in the right direction of how I could accomplish this using Velocity
Thanks
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 29 May, 2014 12:14 PM
Hi,
I believe you can accomplish this by setting a variable to the calling page and using the XPathTool to obtain the nodes.
When you have a moment, give the following a try for starters and let me know how it works out:
Please let me know if you have any questions.
Thanks!
2 Posted by MrFjords on 29 May, 2014 09:44 PM
Thank you, I was able to get what I wanted to happen based on the code you posted.
Thanks!
3 Posted by Ryan Griffith on 30 May, 2014 12:10 PM
Not a problem at all, thank you for following up. I am glad to hear the Velocity snippet helped guide you to a solution.
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 30 May, 2014 12:10 PM.