<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shawson&#039;s Code Blog &#187; XSLT</title>
	<atom:link href="http://codeblog.shawson.co.uk/category/xslt/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeblog.shawson.co.uk</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Tue, 15 May 2012 15:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Paged List of Child Nodes in Umbraco</title>
		<link>http://codeblog.shawson.co.uk/paged-list-of-child-nodes-un-umbraco/</link>
		<comments>http://codeblog.shawson.co.uk/paged-list-of-child-nodes-un-umbraco/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:13:06 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Umbraco]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=388</guid>
		<description><![CDATA[We just started looking at Umbraco- and so I&#8217;m delving into Macro&#8217;s &#8211; these are the packaged up chunks of functionality which make your site actually do things and either take the form of XSLT files which process and spit out the contents of your database, or dot net controls. I found an excellent example [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
<li><a href='http://codeblog.shawson.co.uk/giving-umbraco-trees-children/' rel='bookmark' title='Giving Umbraco custom tree&#8217;s children!'>Giving Umbraco custom tree&#8217;s children!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>We just started looking at Umbraco- and so I&#8217;m delving into Macro&#8217;s &#8211; these are the packaged up chunks of functionality which make your site actually do things and either take the form of XSLT files which process and spit out the contents of your database, or dot net controls.</p>
<p>I found an excellent example XSLT that allows you to create a paginated list of child nodes over on <a href="http://www.nibble.be/?p=11">Tim Geyssens &#8220;nibble&#8221; blog</a>, and I&#8217;ve modified it ever so slightly to stop the numerical index rendering if the pagecount is less than 2- so thought I would re-post it!</p>
<pre class="brush: xslt">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE xsl:stylesheet [
  &lt;!ENTITY nbsp &quot;&amp;amp;amp;amp;#x00A0;&quot;&gt;
]&gt;
&lt;xsl:stylesheet
version=&quot;1.0&quot;
xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:msxml=&quot;urn:schemas-microsoft-com:xslt&quot;
xmlns:umbraco.library=&quot;urn:umbraco.library&quot;
exclude-result-prefixes=&quot;msxml umbraco.library&quot;&gt;

  &lt;xsl:output method=&quot;xml&quot; omit-xml-declaration=&quot;yes&quot;/&gt;
  &lt;xsl:param name=&quot;currentPage&quot;/&gt;
  &lt;xsl:template match=&quot;/&quot;&gt;

    &lt;xsl:variable name=&quot;recordsPerPage&quot; select=&quot;/macro/recordsPerPage&quot;/&gt;
    &lt;xsl:variable name=&quot;pageNumber&quot; &gt;
      &lt;xsl:choose&gt;
        &lt;!-- first page --&gt;
        &lt;xsl:when test=&quot;umbraco.library:RequestQueryString(&#039;page&#039;) &lt;= 0 or string(umbraco.library:RequestQueryString(&#039;page&#039;)) = &#039;&#039; or string(umbraco.library:RequestQueryString(&#039;page&#039;)) = &#039;NaN&#039;&quot;&gt;0&lt;/xsl:when&gt;
        &lt;!-- what was passed in --&gt;
        &lt;xsl:otherwise&gt;
          &lt;xsl:value-of select=&quot;umbraco.library:RequestQueryString(&#039;page&#039;)&quot;/&gt;
        &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;

    &lt;/xsl:variable&gt; &amp;amp;amp;amp;nbsp;

    &lt;xsl:variable name=&quot;numberOfRecords&quot; select=&quot;count($currentPage/node)&quot;/&gt;

    &lt;!-- The fun starts here --&gt;
    &lt;ul&gt;
      &lt;xsl:for-each select=&quot;$currentPage/node [string(data [@alias=&#039;umbracoNaviHide&#039;]) != &#039;1&#039;]&quot;&gt;
        &lt;xsl:if test=&quot;position() &gt; $recordsPerPage * number($pageNumber) and
position() &lt;= number($recordsPerPage * number($pageNumber) +
$recordsPerPage )&quot;&gt;
          &lt;li&gt;
            &lt;a href=&quot;{umbraco.library:NiceUrl(@id)}&quot;&gt;
              &lt;xsl:value-of select=&quot;@nodeName&quot;/&gt;

            &lt;/a&gt;
          &lt;/li&gt;
        &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
    &lt;/ul&gt;

    &lt;xsl:if test=&quot;$pageNumber &gt; 0&quot;&gt;
      &lt;a href=&quot;?page={$pageNumber -1}&quot;&gt;previous &lt;/a&gt;
    &lt;/xsl:if&gt;

&lt;xsl:if test=&quot;($numberOfRecords &gt; $recordsPerPage)&quot;&gt;
    &lt;xsl:call-template name=&quot;for.loop&quot;&gt;
      &lt;xsl:with-param name=&quot;i&quot;&gt;1&lt;/xsl:with-param&gt;
      &lt;xsl:with-param name=&quot;page&quot; select=&quot;$pageNumber +1&quot;&gt;&lt;/xsl:with-param&gt;
      &lt;xsl:with-param name=&quot;count&quot; select=&quot;ceiling(count($currentPage/node)div $recordsPerPage)&quot;&gt;&lt;/xsl:with-param&gt;
    &lt;/xsl:call-template&gt;
&lt;/xsl:if&gt;

    &lt;xsl:if test=&quot;(($pageNumber +1 ) * $recordsPerPage) &lt; ($numberOfRecords)&quot;&gt;
      &lt;a href=&quot;?page={$pageNumber +1}&quot;&gt;next&lt;/a&gt;
    &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template name=&quot;for.loop&quot;&gt;

    &lt;xsl:param name=&quot;i&quot;/&gt;
    &lt;xsl:param name=&quot;count&quot;/&gt;
    &lt;xsl:param name=&quot;page&quot;/&gt;
    &lt;xsl:if test=&quot;$i &lt;= $count - 1&quot;&gt;

      &lt;xsl:if test=&quot;$page != $i&quot;&gt;
        &lt;a href=&quot;{umbraco.library:NiceUrl($currentPage/@id)}?page={$i - 1}&quot; &gt;

          &lt;xsl:value-of select=&quot;$i&quot; /&gt;
        &lt;/a&gt;
      &lt;/xsl:if&gt;

      &lt;xsl:if test=&quot;$page = $i&quot;&gt;

        &lt;xsl:value-of select=&quot;$i&quot; /&gt;

      &lt;/xsl:if&gt;
    &lt;/xsl:if&gt;
    &lt;xsl:if test=&quot;$i &lt;= $count - 1&quot;&gt;
      &lt;xsl:call-template name=&quot;for.loop&quot;&gt;
        &lt;xsl:with-param name=&quot;i&quot;&gt;
          &lt;xsl:value-of select=&quot;$i + 1&quot;/&gt;
        &lt;/xsl:with-param&gt;
        &lt;xsl:with-param name=&quot;count&quot;&gt;
          &lt;xsl:value-of select=&quot;$count&quot;/&gt;
        &lt;/xsl:with-param&gt;
        &lt;xsl:with-param name=&quot;page&quot;&gt;
          &lt;xsl:value-of select=&quot;$page&quot;/&gt;
        &lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
<li><a href='http://codeblog.shawson.co.uk/giving-umbraco-trees-children/' rel='bookmark' title='Giving Umbraco custom tree&#8217;s children!'>Giving Umbraco custom tree&#8217;s children!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/paged-list-of-child-nodes-un-umbraco/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

