on 10-06-2014 11:14 PM
Hi Folks, I have to concatenate multiple occurances of the same field into one string. ABC DEF the output after concatenation ABCDEF I am trying to use string-join function as follows but getting syntax error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kalyan,
try this mapping, just now I wrote:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="//name">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Input file:
<a>
<name>Sandeep</name>
<name>Kalyan</name>
</a>
Output :
SandeepKalyan
Please let me know if you have any question.
Thanks
Sandeep Maurya.
Hi Sandeep, Yes your code works, but I found I have a slightly different requirement
<E1EDKT1 SEGMENT="1">
<TDID>F01</TDID>
<E1EDKT2 SEGMENT="1">
<TDLINE>Combination of Header and Detail</TDLINE>
</E1EDKT2>
<E1EDKT2 SEGMENT="1">
<TDLINE>Concatenated</TDLINE>
</E1EDKT2>
</E1EDKT1>
I need to concatenate TDLINE occurrences based on TDID = F01, to make the output as
<Output>combination of Header and Detail concatenated</Output>
So I am trying with the following code which is not quite concatenating
<xsl:for-each select="E1EDKT1">
<xsl:choose>
<xsl:when test="normalize-space(TDID) = 'F01'">
<xsl:for-each select="E1EDKT2/TDLINE">
<Output>
<xsl:value-of select="." />
</Output>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Hi Sandeep, I think I got it with a slight modification, Thank You.
<xsl:for-each select="E1EDKT1">
<xsl:choose>
<xsl:when test="normalize-space(TDID) = 'F01'">
<Reference>
<xsl:for-each select="E1EDKT2/TDLINE">
<xsl:value-of select="."/>
</xsl:for-each>
</Reference>
</xsl:when>
</xsl:choose>
</xsl:for-each>
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.