RE: [xsl] how to add a cell in a for-each iteration?

Subject: RE: [xsl] how to add a cell in a for-each iteration?
From: Bodrul Haque <Bodrul.Haque@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Jul 2002 13:07:51 +0100
Hi Thomas
If I understand you correctly, all you have to do is

<xsl:for-each select="list/item">
     <xsl:value-of select = "."/>
     <xsl:text> | </xsl:text>


-----Original Message-----
From: Thomas Sandor [mailto:tsandor@xxxxxxxxxxx] 
Sent: 30 July 2002 12:40
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] how to add a cell in a for-each iteration?


I've just started to build a website using Cocoon engine, and use
XML/XSLT -> HTML tranforms. I've read a lot on XSL formatting, and
everything goes clear, except for one problem. I'd like to add eg.: " | " in
between an iteration.

Eg.: <list>
        <item>menu 1</item>
        <item>menu 2</item>
        <item>menu 3</item>

and in a XSLT template:
    <xsl:for-each select="list/item">
        <xsl:value-of select = "."/>

would list them.

So what I'd like to achieve is to insert eg.: " | " string in between my
<item>s to perform: "menu 1 | menu 2 | menu 3" string.

I could make it happen using an <xsl:variable> eg. like this one:

  <xsl:variable name = "bool">
    <xsl:when test = "$bool = 'true'">false</xsl:when>

and say:

  <xsl:if test = "$bool = 'true'"> | </xsl:if>

but it seems that inside the for-each cycle it ain't change its value.

I would appreciate, if someone could tell me how to make it work to produce
my desired output, and not appear it every 2nd time as it goes right now.

Thanks in advance.


 XSL-List info and archive:


The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged
Any views or opinions presented in this Email message are solely those 
of the author and do not necessarily represent those of Synergy 
Logistics Limited  unless specifically stated. 
Email communications are not necessarily secure and therefore 
Synergy Logistics Limited does not accept legal responsibility for the 
contents of this message. 
If you are not the intended recipient and have received this message in 
error, Please notify Synergy Logistics Limited immediately. 

         Synergy Logistics Ltd. 01509 232706

 XSL-List info and archive:

Current Thread