[xsl] Grouping data

Subject: [xsl] Grouping data
From: Daniel Rodríguez Díaz <danielr@xxxxxxxxxxxxx>
Date: Thu, 16 Jan 2003 16:09:48 +0100
Hi,
I've got an xml document with 5 nodes and I try to transform it from xml into html in the following way:
I want to put the first 3 nodes inside a <p></p> using certain template, the rest inside a <div></div> using a different template.


I know how to manage the elements and count them but I don't know how to create a node including templates when I'm in the first or third node.

Here is an example to explain better:


XML


<raiz>
<item>
<nombre>Uno</nombre>
<apellidos>1111</apellidos>
</item>
<item>
<nombre>Dos</nombre>
<apellidos>2222</apellidos>
</item>
<item>
<nombre>Tres</nombre>
<apellidos>3333</apellidos>
</item>
<item>
<nombre>Cuatro</nombre>
<apellidos>4444</apellidos>
</item>
<item>
<nombre>Cinco</nombre>
<apellidos>5555</apellidos>
</item>
</raiz>


HTML


<p>
<h1>Uno</h1><h2>1111</h2>
<h1>Dos</h1><h2>2222</h2>
<h1>Tres</h1><h2>3333</h2>
</p>
<div>
<h3>Cinco</h3>
<h3>Cinco</h3>
</div>

Thanks in advance


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread