Skip to Content
0

XML to text conversion in HCI using below format

Dec 16, 2017 at 02:22 PM

230

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,

Md.Thouheed

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
0

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="http://www.w3.org/1999/XSL/Transform"
     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 ="/">
     <html>
       <head> 
         <script language="javascript" type="text/javascript"></script>
       </head>
       <body>
         <table border="1">
       <xsl:for-each select="Root/Header">
         <tr>        
           <td>              
             <xsl:value-of select="Field1" />
           </td>        
           <td>            
             <xsl:value-of select="Field2"/>
           </td>        
           <td>            
             <xsl:value-of select="Field3"/>
           </td>        
           <td>            
             <xsl:value-of select="Field4"/>
           </td>        
           <td>            
             <xsl:value-of select="Field5"/>
           </td>        
             <td>              
               <xsl:value-of select="Field6"/>        
             </td> 
           <xsl:text>
</xsl:text>
         </tr>
       </xsl:for-each>
     </table>
         <br/>
         <br/>
         <form id ="form" method="post" >        
         </form>
         </body>
     </html>
   </xsl:template>
 </xsl:stylesheet>

Thanks and Regrads,

Md.Thouheed

Share
10 |10000 characters needed characters left characters exceeded