[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
AW: [xsl] how to add a cell in a for-each iteration?
Subject: AW: [xsl] how to add a cell in a for-each iteration? From: "Thomas Bayer" <bayer@xxxxxx> Date: Tue, 30 Jul 2002 13:58:07 +0200 |
hi, just test, if the current item isn't last one inside the for-each. <xsl:for-each select="list/item"> <xsl:value-of select = "."/> <xsl:if text="position()!=last()"> | </xsl:if> </xsl:for-each> Thomas, Orientation in Objects http://www.oio.de > -----Ursprüngliche Nachricht----- > Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]Im Auftrag von Thomas > Sandor > Gesendet: Dienstag, 30. Juli 2002 13:40 > An: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Betreff: [xsl] how to add a cell in a for-each iteration? > > > hi, > > 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> > </list> > > and in a XSLT template: > <xsl:for-each select="list/item"> > <xsl:value-of select = "."/> > </xsl:for-each> > > 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:choose> > <xsl:when test = "$bool = 'true'">false</xsl:when> > <xsl:otherwise>true</xsl:otherwise> > </xsl:choose> > </xsl:variable> > > 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. > > Regards, > Thomas > > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to add a cell in a fo, Jeni Tennison | Thread | Re: [xsl] how to add a cell in a fo, David Carlisle |
Re: [xsl] how to add a cell in a fo, Jeni Tennison | Date | Re: [xsl] xpath - check for no cont, Joerg Heinicke |
Month |