Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • DavidS 17 posts 38 karma points
    May 11, 2010 @ 00:17
    DavidS
    0

    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

     

     

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 11, 2010 @ 00:33
    Lee Kelleher
    1

    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:

    $currentPage/following::node[@level=4]

    Have a play with Chriztian Steinmeier's XPath Axes Visualizer...

    http://pimpmyxslt.com/axesviz.aspx?contextNode=1072&axis=following#screen

    Good luck, Lee.

  • DavidS 17 posts 38 karma points
    May 11, 2010 @ 08:39
    DavidS
    0

    Cheers Lee,

    I'll give that a go.

     

    David

  • DavidS 17 posts 38 karma points
    May 11, 2010 @ 11:07
    DavidS
    0

    Thanks Lee,

    That did the trick!

     

    David

  • Avinash 2 posts 22 karma points
    Feb 13, 2013 @ 11:32
    Avinash
    0

    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>

     

Please Sign in or register to post replies

Write your reply to:

Draft