XSL: for-each with max items

by Pieter Brinkman 5. August 2009 09:21

While working with Umbraco and Sitecore I learned some Xsl tricks.

The following example shows how to show the first 10 items in a HTML list.

[code:xml]
<ul>
  <xsl:for-each select="*">
    <xsl:if test="position()&lt;='9'">
      <li>
 <a href="{@link}">
   <xsl:value-of select="@name"/>
  </a>
      </li>
    </xsl:if>
  </xsl:for-each>
</ul>
[/code]

 

Tags: , , ,

XSL

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Me

My name is Pieter Brinkman I am Solution Architect for Sitecore in The Netherlands. My interests are mainly ASP.NET, MSSQL and Content Management Systems.

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

RecentComments

Comment RSS

Most comments