Skip to Content

XML to text conversion in HCI using below format

Dec 16, 2017 at 02:22 PM


avatar image

Hi Experts,

I'm trying to convert incoming xml payload to txt, i have tried with xml to csv converter but not getting it properly with tab delimiter. however client require a txt file as below(does not have delimiter but the data fields are right and left justified.

Help me to convert xml to text file and also i need to consider the field justifications.

Any groovy script or XSLT mapping would be helpful.

Output looks like:

Field1          F2 F3      F4            F5 Field6
000451000206    INR0004    C              22000000024100017#TRAN_SUCCESS
000451000206    INR0004    C              12000000024100017#TRAN_SUCCESS

Please suggest how to archive it.

Thanks and Regrads,


1.jpg (30.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mohammad Thouheed Dec 26, 2017 at 10:34 AM

Hi All,

This question has been resolved by using XSLT code.

<?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0" xmlns:xsl=""
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
 <?xml-stylesheet href="FILE.xsl" type="text/xsl"?>
     <xsl:output method="text"/>
      <xsl:template match ="/">
         <script language="javascript" type="text/javascript"></script>
         <table border="1">
       <xsl:for-each select="Root/Header">
             <xsl:value-of select="Field1" />
             <xsl:value-of select="Field2"/>
             <xsl:value-of select="Field3"/>
             <xsl:value-of select="Field4"/>
             <xsl:value-of select="Field5"/>
               <xsl:value-of select="Field6"/>        
         <form id ="form" method="post" >        

Thanks and Regrads,


10 |10000 characters needed characters left characters exceeded