Skip to content

Instantly share code, notes, and snippets.

@birkir
Created June 4, 2014 13:34
Show Gist options
  • Save birkir/8bef29580e0c362df0b0 to your computer and use it in GitHub Desktop.
Save birkir/8bef29580e0c362df0b0 to your computer and use it in GitHub Desktop.
Next/Prev News Items Navigation
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:control="lisa:ControlInfo" xmlns:lisa="lisa:XsltExtensions" exclude-result-prefixes="lisa control">
<xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>
<xsl:param name="query-string"/>
<xsl:param name="NewsPageId"/>
<xsl:variable name="newsid" select="$query-string/param[@name = 'NewsId']" />
<xsl:template match="News">
<xsl:for-each select="Item">
<xsl:sort select="Start" order="ascending"/>
<xsl:if test="NewsItemId = $newsid">
<xsl:if test="position() &gt; 1">
<a href="/?pageid=&amp;newsid={//Item[position() - 1]/NewsItemId}">Fyrri</a>
</xsl:if>
<xsl:if test="position() &lt; count(//Item)">
<a href="/?pageid=&amp;newsid={//Item[position() + 1]/NewsItemId}">Næsta</a>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment