if suppose the same tags will be repeated but for that tag value will be different since i need to fetch separately by using xslt, if i am doing that the two tag value was getting in singleline
here is my xml:
<local>
<message>
<block4>
<tag>
<name>72</name>
<value>ALW103111102000001</value>
</tag>
<tag>
<name>70</name>
<value>TESTING CITI BANK EFT9</value>
</tag>
<tag>
<name>71A</name>
<value>OUR</value>
</tag>
<tag>
<name>72</name>
<value>ipubby</value>
</tag>
</block4>
</message>
</local>
here is my xslt:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="local/message">
<xsl:for-each select ="block4/tag[name = '72']">
<xsl:value-of select="value"/>
</xsl:for-each>,<xsl:text/>
<xsl:for-each select ="block4/tag[name = '72']">
<xsl:value-of select="value"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
output required as :
ALW103111102000001,ipubby
It looks like what you are asking is that you want to match all the tag elements with a name of 72, and concatenate the values on to one single line.
At the the moment, you are nesting your xsl:for-each statements, which result in the elements getting selected twice, and your output line is getting duplicated.
What you need to do, is simply select the first tag like so
And then you can get the remaining tags like so….
Note that it would be preferable to use xsl:apply-templates to match the nodes, rather than xsl:for-each.
Here is the full XSLT
When applied to your given input XML, the output is as follows: