Hi Tristan,
for your simple problem I would suggest an iterative solution,
using foreach with variables without using keys.
<xsl:template match="Tracklisting">
<table>
<tr>
<td colspan="2">Disk <xsl:value-of select="Track[1]/Disk"/></td>
</tr>
<xsl:variable name="tracks" select="Track"/>
<xsl:for-each select="$tracks">
<xsl:variable name="pos" select="position()"/>
<xsl:choose>
<xsl:when test="not(position() mod 2)">
<tr>
<td><xsl:value-of select="$tracks[$pos - 1]/Track"/>.
<xsl:value-of select="$tracks[$pos - 1]/Title"/></td>
<td><xsl:value-of select="$tracks[$pos]/Track"/>.
<xsl:value-of select="$tracks[$pos]/Title"/></td>
</tr>
</xsl:when>
<xsl:when test="$pos=last()">
<tr>
<td><xsl:value-of select="$tracks[$pos]/Track"/>.
<xsl:value-of select="$tracks[$pos]/Title"/></td>
<td>*</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template>
Cheers,
Juergen
-----Ursprüngliche Nachricht-----
Von: Tristan Griffiths
[mailto:tristan(_dot_)griffiths(_at_)stomp(_dot_)com(_dot_)au]
Gesendet am: Mittwoch, 24. September 2003 07:40
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: [xsl] Grouping question
Ok, I am pretty sure I need to use xsl keys with muenching grouping.
Trouble is, I can't seem to get my head around it to make it work for
the down/across table layout.
I've done some gouping using the examples and can see how to group
(grouping products (CD's) in to genres). I have found nothing to help me
do the down/across layout.
Mukul Gandhi wrote:
You may try Muenching grouping.. A good reference is
--
http://www.jenitennison.com/xslt/grouping/index.html
Regards,
Mukul
Tristan Griffiths <tristan(_dot_)griffiths(_at_)stomp(_dot_)com(_dot_)au>
wrote:Hello all, this is my first post so please be
nice. After much googling
I ended up here. It's a painful problem that I'm sure
someone has solved
before but google just doesn't seem to find the
answer.
I have an XML structure like this:
1
1
1
2
1
3
...
I would like to output a HTML table like this:
Disk 1
1. THE PACKAGE
2. WEAK AND POWERLESS
3. THE NOOSE*
*
So basically it is a balanced, two column table, down
and across. Is
this possible with XSLT? I have experimented with keys
but I'm afraid I
have even less of an understanding of them now than I
did before. I've
just gotten confused.
Little help?
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
*****************************************************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren
sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail
in error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.
*****************************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list