Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:25+00:00 2026-05-26T15:15:25+00:00

if suppose the same tags will be repeated but for that tag value will

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:15:25+00:00Added an answer on May 26, 2026 at 3:15 pm

    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

    <xsl:value-of select="block4/tag[name = '72'][1]/value"/>
    

    And then you can get the remaining tags like so….

    <xsl:for-each select="block4/tag[name = '72'][position() > 1]">
    

    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

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="text"/>
    
       <xsl:template match="/">
          <xsl:apply-templates select="local/message"/>
       </xsl:template>
    
       <xsl:template match="message">
          <xsl:value-of select="block4/tag[name = '72'][1]/value"/>
          <xsl:apply-templates select="block4/tag[name = '72'][position() &gt; 1]"/>
       </xsl:template>
    
       <xsl:template match="tag">
          <xsl:text>,</xsl:text>
          <xsl:value-of select="value"/>
       </xsl:template>
    </xsl:stylesheet>
    

    When applied to your given input XML, the output is as follows:

    ALW103111102000001,ipubby
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that I have two objects with the same property name that I am
Suppose I have 2 enumerations that I know have the same number of elements
This is the same question as: Explicit Element Closing Tags with System.Xml.Linq Namespace but
Suppose I've got 2 different modules which have the uniform(same) interfaces. The files list
Suppose that ThreadA and ThreadB both call WaitOne() in that order on the same
Suppose I have two methods, Foo and Bar , that do roughly the same
Does Pickle always produce the same output for a certain input value? I suppose
Can I suppose that, from the call stack point view, it's the same to
So suppose 1 Gemfile uses devise 1.0 and another one also requires that same
Suppose I have two classes with the same interface: interface ISomeInterface { int foo{get;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.