This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Simple Grouping
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Simple Grouping
- From: Edmund Mitchell <EMitchell at fnf dot com>
- Date: Fri, 16 Mar 2001 11:40:31 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello
>From the FAQ at http://www.dpawson.co.uk/xsl/N4486.html#N24517
Steve Tinney offers
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="triples">
<xsl:with-param name="nodes" select="/*/f"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="triples">
<xsl:param name="nodes"/>
<tr><td><xsl:value-of select="$nodes[1]"/></td>
<td><xsl:value-of select="$nodes[2]"/></td>
<td><xsl:value-of
select="$nodes[3]"/></td></tr>
<xsl:if test="count($nodes) > 3">
<xsl:call-template name="triples">
<xsl:with-param name="nodes"
select="$nodes[position() > 3]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
A bit of modification to match your element names, and you'll be set.
Also, check www.jenitennison.com for some good grouping examples.
Hope that helps
Edmund
-----Original Message-----
From: ICARO [mailto:icaro@mi.madritel.es]
Sent: Friday, March 16, 2001 2:17 PM
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] Simple Grouping
Hi all, I´m new in the xsl world and i have this problem:
I have an xml doc like that:
<list>
<image>#</image>
<image>#</image>
<image>#</image>
<image>#</image>
....
</list>
I need to create a table in which i want to group 3 images for each table
row, so the output looks like:
<table>
<tr>
<td>image</td>
<td>image</td>
<td>image</td>
</tr>
<tr>
<td>image</td>
<td>image</td>
<td>image</td>
</tr>
...
</table>
Thanks for your help!
ivan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list