xsl-list
[Top] [All Lists]

Re: concating strings in a loop

2004-02-06 05:32:12
Lainaus Herwig Posedu <herwig(_dot_)posedu(_at_)unycom(_dot_)com>:

< Jarkko(_dot_)Moilanen(_at_)uta(_dot_)fi wrote:
<
< >Lainaus Jarkko(_dot_)Moilanen(_at_)uta(_dot_)fi:
< >
< >< Lainaus Herwig Posedu <herwig(_dot_)posedu(_at_)unycom(_dot_)com>:
< ><
< >< < hi!
< >< < i want to display a list of persons "comma-seperarted" on my pdf-file.
< >< < how can i concate those person-names seperated with a "," but in that
< >< < way, that after the last name is no ",".
< >< < i did it like this
< >< <
< >< < <xsl:for-each select="person">
< >< < <xsl:value-of select="name" />
< >< < ,<fo:inline color="white">.</fo:inline>
< >< < </xsl:for-each>
< >< < -> the output for example is: mike, john,
< >< < -> i want to have: mike, john
< >< < how can i concate the strings and substring it, so that the last comma
< >< < will be removed
< ><
< >< <xsl:for-each select="person">
< ><  <xsl:value-of select="name" />
< ><  <xsl:if test="../position()!=last()">,</xsl:if>
< >< </xsl:for-each>
< >
< >Uuups....
< >Shoudl probably work better if:
< >
< ><xsl:for-each select="person">
< >  <xsl:value-of select="name" />
< >  <xsl:if test="position()!=last()">,</xsl:if>
< > </xsl:for-each>
< >
< >
< >***************************************************
< >* Jarkko Moilanen                                 *
< >* Dokumentoinnin kehittäjä                        *
< >* Profound XML technology Expert                  *
< >* DokuMentori Oy                                  *
< >* www.dokumentori.fi                              *
< >***************************************************
< >
< > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
< >
< >
< perfect, thank you. there is another question i have: is it possible to
< count the persons in the loop, so that i can say:
< person1: mike, person2 joe    and so on
<
<

<xsl:for-each select="person">
   <xsl:value-of select="position()"/>:
   <xsl:value-of select="name" />
   <xsl:if test="position()!=last()">,</xsl:if>
 </xsl:for-each>


***************************************************
* Jarkko Moilanen                                 *
* Dokumentoinnin kehittäjä                        *
* Profound XML technology Expert                  *
* DokuMentori Oy                                  *
* www.dokumentori.fi                              *
***************************************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>