kalyangkm
asked on
Concatenating multiple occurrences of the same field into one string
Hi
I have to concatenate the multiple occurrences of the same field as follows, FYI, I am using xslt 1.0
Input code fragment
Output desired
Code that I am trying to apply by using string-join function
I have to concatenate the multiple occurrences of the same field as follows, FYI, I am using xslt 1.0
Input code fragment
<E1EDKT1 SEGMENT="1">
<TDID>ZTDT</TDID>
<E1EDKT2 SEGMENT="1"/>
<TDLINE>ABC</TDLINE>
</E1EDKT2>
<E1EDKT2 SEGMENT="1"/>
<TDLINE>DEF</TDLINE>
</E1EDKT2>
</E1EDKT1>
Output desired
<Reference> ABCDEF </Reference>
Code that I am trying to apply by using string-join function
<Reference>
<xsl:when test="normalize-space(E1EDKT1/TDID) = 'ZTDT'">
<xsl:value-of select="fn:string-join(/E1EDKT2/TDLINE, ' ')" />
</xsl:when>
</Reference>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
value-of does concatenate all the string nodes found
you can also use concat()
<Reference>
<xsl:value-of select="concat(E1EDKT2[1]/ TDLINE, ' ', E1EDKT2[2]/TDLINE)"/>
</Reference>
If you want a space in between (and you know there is only two)
Depending on the exact requirements there is a lot more you can do
you can also use concat()
<Reference>
<xsl:value-of select="concat(E1EDKT2[1]/
</Reference>
If you want a space in between (and you know there is only two)
Depending on the exact requirements there is a lot more you can do
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Because it is the correct solution
ASKER
Open in new window