Veljko
Veljko

Reputation: 1808

XSLT for-each ->how to return result only in one element

I have for each part in my XSLT:

<xsl:for-each select="Engineers/Value">
<wor1:Engineer><xsl:value-of select="Name"/>;</wor1:Engineer>
</xsl:for-each>

and my output is like this (in case when result returns 3 elements)

<wor1:Engineer>John;</wor1:Engineer>
<wor1:Engineer>Susan;</wor1:Engineer>
<wor1:Engineer>Bob;</wor1:Engineer>

But I want result like this only in ONE row:

 <wor1:Engineer>John;Susan;Bob;</wor1:Engineer>

Is this possible?

Upvotes: 0

Views: 555

Answers (2)

Michael Kay
Michael Kay

Reputation: 163458

Or in XSLT 3.0

<wor1:Engineer>{Engineers/Value!(Name||';')}</wor1:Engineer>

Upvotes: 0

user2177304
user2177304

Reputation:

<wor1:Engineer>
  <xsl:for-each select="Engineers/Value">
    <xsl:value-of select="Name"/>
    <xsl:text>;</xsl:text>
  </xsl:for-each>
</wor1:Engineer>

Upvotes: 3

Related Questions