Formatting XSLT document to display multiple nicknames on a single line

KhIrfan

New Member
My xml documents contain a list of people, and these people can have 0 or more nicknames. I am having trouble trying to display all the nicknames properly in my xslt document. I can have all the nicknames listed by using:\[code\]<xsl:for-each select="name/nickname"> Nickname: <xsl:value-of select="." /></xsl:for-each>\[/code\]The output of this is something like:\[code\]Nickname: nickname1Nickname: nickname2\[/code\]Which is a problem as I would like to get an output without Nickname: being listed so many times, i.e.\[code\]Nickname: nickname1, nickname2.\[/code\]What I currently have is:\[code\]<p> Nickname: <xsl:for-each select="name/nickname"> <xsl:value-of select="." />, </xsl:for-each></p>\[/code\]Problems with this are:[*]Nickname will always be printed at least once even if a nickname doesn't exist.[*]There will always be a left over comma (,).I am hoping there are suggestions to get around these two issues, I tried to use != "" but I'm not sure if this is allowed if an person doesn't contain a nickname.Thanks :)
 
Top