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 6046137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:12:13+00:00 2026-05-23T07:12:13+00:00

here is my below xml under that table due based on CTD_CTD_PKG_ID(some time under

  • 0

here is my below xml under that table due based on CTD_CTD_PKG_ID(some time under table CTD_CTD_PKG_ID id was same means we need take data from both tables ) this pack id we need to generate a text file with the help of xsl style sheet but how to write logic code in xslt

for some fields data were same for that type of records for me dont want to repeat once again only once i need but how to control if i am getting two records of CTD_LANG_ID needed to display once but i have written xslt i was thinking it was not correct we will fail when we are have xml with one more table with different package id(CTD_CTD_PKG_ID) at that time lang id may be different than E but this xslt were showing E it self …

 <?xml version="1.0" standalone="yes"?>
 <NewDataSet>
  <Table>
<RECORD_TYPE_CODE>CTD</RECORD_TYPE_CODE>
<MSG_TYPE_CODE>O102</MSG_TYPE_CODE>
<CTD_SEQ_NUM>089938</CTD_SEQ_NUM>    
<CTD_CTD_PKG_ID>345</CTD_CTD_PKG_ID>
<CTD_LANG_ID>E</CTD_LANG_ID>
 </Table>
 <Table>
<RECORD_TYPE_CODE>ITD</RECORD_TYPE_CODE>
<MSG_TYPE_CODE>O103</MSG_TYPE_CODE>
<CTD_SEQ_NUM>089939</CTD_SEQ_NUM>    
<CTD_CTD_PKG_ID>345</CTD_CTD_PKG_ID>
<CTD_LANG_ID>E</CTD_LANG_ID>
</Table>   
</NewDataSet>

I HAVE A WRITTEN MY OWN XSLT LOGIC BUT IT DOESN’T WORK

<?xml version="1.0" encoding="utf-8"?>

<xsl:output method="text" indent="no" omit-xml-declaration="yes" />

<xsl:param name="PackageId"  />


<xsl:template match="/">        
    <xsl:apply-templates select="NewDataSet/Table[CTD_CTD_PKG_ID ='345']"/>     
</xsl:template>



<xsl:template match="NewDataSet/Table[CTD_CTD_PKG_ID ='345']">

    <xsl:value-of select= "concat(':25:',./TRAN_TYPE_CODE)"/>,<xsl:text/>
    <xsl:if test ="./RECORD_TYPE_CODE"  >
        <xsl:if test=" position() &gt; 1"></xsl:if>
        <xsl:text/><xsl:value-of select= "concat(':20:',./RECORD_TYPE_CODE)"/>,<xsl:text/>
    </xsl:if>
    <xsl:if test ="./MSG_TYPE_CODE" >
        <xsl:if test=" position() &gt; 1"></xsl:if>
        <xsl:text/><xsl:value-of select= "concat(':21:',./MSG_TYPE_CODE)"/>,<xsl:text/>
    </xsl:if>
    <xsl:if test ="./CTD_SEQ_NUM" >
        <xsl:if test=" position() &gt; 1"></xsl:if>
        <xsl:text/><xsl:value-of select= "concat(':22:',./CTD_SEQ_NUM)"/>,<xsl:text/>
    </xsl:if>
</xsl:template> 


Execpected output

:25:E,:20:CTD,:21:O102N,:22:089938,:20:ITD,:21:O103N,:22:089939,

  • 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-23T07:12:14+00:00Added an answer on May 23, 2026 at 7:12 am

    Here is a sample stylesheet:

    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="1.0">
    
      <xsl:output method="text"/>
    
      <xsl:param name="packageId" select="345"/>
    
      <xsl:template match="/">
        <xsl:apply-templates select="NewDataSet/Table[CTD_CTD_PKG_ID = $packageId]"/>
      </xsl:template>
    
      <xsl:template match="Table">
        <xsl:if test="position() &gt; 1">,</xsl:if>
        <xsl:apply-templates select="RECORD_TYPE_CODE | MSG_TYPE_CODE | CTD_SEQ_NUM"/>
      </xsl:template>
    
      <xsl:template match="Table/*">
        <xsl:if test="position() &gt; 1">,</xsl:if>
        <xsl:value-of select="."/>
      </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update an element in the XML document below: Here's the code:
I have an xml as below < Image>ImageValue1 <Type>png</Type> <Value>ImageValue1</ Value> </ Image> Here
Here is my current question: I'm guessing that my problem (described below) is being
How to find below comment block(s) with javascript/jquery regex: /* some description here */
Here are the problems with the LINQ to XML below: Is there a way
I'm trying to parse out the XML below with the PHP code shown here
I am trying to write a function that will take an xml object, an
I just have some codes here to clarify my doubts on linq xml parsing.
Here's a question about repeated nodes and missing values. Given the xml below is
I have the below XML. Here I want to get the previous sibling of

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.