I was wondering if anyone could help out on the following problem. I've got the following site structure
Questionnaire
Stage 1
Page 1
Page 2
Page 3
Stage 2
Page 4
Page 5
Now only the contents of "Page 1" to "Page 5" will only ever be shown to the user. What I want to implement is pagination of "Page 1" to "Page 5".
So for instance, if the user is on "Page 1", I'd like only a "Next" button to appear. Likewise if the user were to be on "Page 5" only a "Previous" button should appear. Similarly if the user were to be on any other page, both the "Next" and "Previous" buttons would appear.
I've tried using $currentPage/preceding-slbling and $currentPage/following-sibling but due to the structure of the site, "Page 3" and "Page 4" are problematic since they are child nodes of "Stage 1" and "Stage 2" respectively.
Is this one of the situations where I'd be better off using .NET to implement the macro? Or is there a clever way of doing it in XSLT?
I'm not sure what level your nodes are in the content tree, but I'll make an assumption that the Questionnaire is @level = 2, so try this XPath for the Pages:
$currentPage/following::node[@level=4]
Have a play with Chriztian Steinmeier's XPath Axes Visualizer...
XSLT previous next button with a twist
Hi all,
I was wondering if anyone could help out on the following problem. I've got the following site structure
Questionnaire
Stage 1
Page 1
Page 2
Page 3
Stage 2
Page 4
Page 5
Now only the contents of "Page 1" to "Page 5" will only ever be shown to the user. What I want to implement is pagination of "Page 1" to "Page 5".
So for instance, if the user is on "Page 1", I'd like only a "Next" button to appear. Likewise if the user were to be on "Page 5" only a "Previous" button should appear. Similarly if the user were to be on any other page, both the "Next" and "Previous" buttons would appear.
I've tried using $currentPage/preceding-slbling and $currentPage/following-sibling but due to the structure of the site, "Page 3" and "Page 4" are problematic since they are child nodes of "Stage 1" and "Stage 2" respectively.
Is this one of the situations where I'd be better off using .NET to implement the macro? Or is there a clever way of doing it in XSLT?
TIA
David
Hi David,
I'm not sure what level your nodes are in the content tree, but I'll make an assumption that the Questionnaire is @level = 2, so try this XPath for the Pages:
Have a play with Chriztian Steinmeier's XPath Axes Visualizer...
http://pimpmyxslt.com/axesviz.aspx?contextNode=1072&axis=following#screen
Good luck, Lee.
Cheers Lee,
I'll give that a go.
David
Thanks Lee,
That did the trick!
David
Hi,
Need Help, I am new to xslt, can someone please tell me where and how can add Next/Prev buttons in the xslt below i have.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="channel">
<xsl:for-each select="item">
<div>
<span class="oj-title">
<xsl:value-of select="@title"></xsl:value-of>
</span>
<br/>
<xsl:if test="@businessArea != ''">
<span class="oj-description">
<b>Reporting Segment: </b>
<xsl:value-of select="@businessArea"></xsl:value-of>
</span>
<br/>
</xsl:if>
<xsl:if test="@businessCountry != ''">
<span class="oj-description">
<b>Country: </b>
<xsl:value-of select="@businessCountry"></xsl:value-of>
</span>
<br/>
</xsl:if>
<xsl:if test="@jobLocation != ''">
<span class="oj-description">
<b>Location: </b>
<xsl:value-of select="@jobLocation"></xsl:value-of>
</span>
<br/>
</xsl:if>
<div class="oj-btnwrap">
<a class="oj-view">
<xsl:attribute name="href">
<xsl:value-of select="@link"/>
</xsl:attribute>
View Details
</a>
</div>
<div class="metso-clear"></div>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
is working on a reply...