[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Output multiple occurence into one and concatenate values


Subject: Re: [xsl] Output multiple occurence into one and concatenate values
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 29 Mar 2007 18:41:14 +0200

Shaikh, Parvez wrote:
I have an XML that has 2 or more occurences of data. I want to comma

delimit the attribute values and output it only once. How do you do that

You did not include your XSLT, so I have no clues as to how you go wrong or what you tried. Do you use XSLT 1 or 2? In XSLT 2 you can do this:


<xsl:value-of select="//@project" separator="," />

make sure you place it in the right context. But to help you with that, we need to have a look at your current XSLT and what it currently (wrongly) produces.

In XSLT 1, btw, you can simply use apply-templates on the selection of the attribute nodes and do this in the matching template:

<xsl:template match="@project" >
   <xsl:value-of select="." />
   <xsl:text>,</xsl:text>
</xsl:template>


Cheers, -- Abel Braaksma


Current Thread
Keywords