RE: Interleaving two lists

Subject: RE: Interleaving two lists
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 28 Jul 2000 13:36:48 +0100
The first idea that comes to mind is something like:

<xsl:for-each select="imagelist/image">
    <xsl:variable name="pos" select="position()"/>
    <xsl:apply-templates select="."/>
    <xsl:apply-templates
select="ancestor::body/paralist/para[position()=$pos]"/>
</xsl:for-each>

Mike Kay

> -----Original Message-----
> From: Manuel Montoro [mailto:mmontoro@xxxxxxxxxxx]
> Sent: 28 July 2000 11:43
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: Interleaving two lists
> 
> 
> Hi all,
> 
> I have an interesting and curious one. I think it hasn't show in the 
> list before. If so, sorry for reiterate....
> 
> Suppose the following XML snip:
> <body>
> 	<imagelist>
> 		<image href="img1.jpg"/>
> 		<image href="img2.jpg"/>
> 		......
> 	</imagelist>
> 	<paralist>
> 		<para>Blah, blah....</para>
> 		<para>Burli, burli...</para>
> 		....
> 	</paralist>
> </data>
> 
> and I want to transform it in something like this:
> <table>
> 	<tr>
> 		<td>
> 			<img src="img1.jpg"/>
> 		</td>
> 		<td>
> 			<p>Blah, blah....</p>
> 		</td>
> 	</tr>
> 	<tr>
> 		<td>
> 			<p>Burli, burli....</p>
> 		</td>
> 		<td>
> 			<img src="img2.jpg"/>
> 		</td>
> 	</tr>
> 	.......
> </table>
> 
> Please note that the image and paragraph lists don't have to be the 
> same size.
> 
> Surprisingly (or not that surprise due to my condition of XSLT 
> novice) I'm in trouble trying to get it working. Due to the intrinsic 
> recursive nature of the XSLT templates, I don't imagine how to 
> iterate through two node sets at the same time.
> 
> Suggestions, anyone?
> 
> Kind Regards
> 
> --------------------------------------------------
> Manuel Montoro
> Responsable Producto
> Novasoft, S.A.
> Telf: 952978012
> E-mail: mmontoro@xxxxxxxxxxx
> 
> Pensamiento del Dia:
>     Hay que estudiar mucho para saber poco
>                                             Baron de Montesquieu.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread