I need to render a specified number of elements from an XML source, where the elements "DueDate" is not exeeded. Here is an example of the xml:
<Items>
<Item>
<Title>Title 1</Title>
<DueDate>01-02-2008</DueDate>
</Item>
<Item>
<Title>Title 2</Title>
<DueDate>01-02-2009</DueDate>
</Item>
<Item>
<Title>Title 3</Title>
<DueDate>01-02-2010</DueDate>
</Item>
<Item>
<Title>Title 4</Title>
<DueDate>01-02-2011</DueDate>
</Item>
<Item>
<Title>Title 5</Title>
<DueDate>01-02-2012</DueDate>
</Item>
<Item>
<Title>Title 6</Title>
<DueDate>01-02-2013</DueDate>
</Item>
</Items>
The number of elements to display and the current date are passed to the XSLT as paramaters. Is it possible to count the number of rendered elements in a for-each loop in Xslt? Or is there a better approach?
An example could be that the limit was set to 3 elements. In this example I would expect to see the following results: "Title 3", "Title 4" and "Title 5".