[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Interleaving two lists

Subject: RE: Interleaving two lists
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 28 Jul 2000 13:36:48 +0100
foreach two lists
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.