I need to render the following format in XSLT. I have a <xsl:for-each loop with 5 elements (Text1, Text2… Text5) and need to wrap an ul tag after every three elements. Any suggestions please?
<ul>
<li>Text1</li>
<li>Text2</li>
<li>Text3</li>
</uL>
<ul>
<li>Text4</li>
<li>Text5</li>
</uL>
Good question, +1.
This transformation:
when applied on the following XML document:
produces the wanted, correct result (things in groups of consecutive three):
Explanation:
Template pattern matching the first
thingof a group of threethingelements.Using modes to process a group of
thingelements (in a different way than the processing of the initial startingthing), once determined.