I'm trying to take my XML document and transform it a different XML structure using XSLT.
Here's my input XML:
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
<FTPRemoteHost>RACHEL</FTPRemoteHost>
<CodeListValues>
<BCBSRI_FTP_GET>
<PARM>CD</PARM>
<VALUE>/Desktop/Rachel</VALUE>
<DTM/>
</BCBSRI_FTP_GET>
<BCBSRI_FTP_GET>
<PARM>FTPProfileName</PARM>
<VALUE>1234567890</VALUE>
<DTM>yyyyMMdd</DTM>
</BCBSRI_FTP_GET>
<BCBSRI_FTP_GET>
<PARM>FileName1</PARM>
<VALUE>Rachel.txt</VALUE>
<DTM>yyyyMMdd</DTM>
</BCBSRI_FTP_GET>
<BCBSRI_FTP_GET>
<PARM>MV/DEL</PARM>
<VALUE>MOVE</VALUE>
<DTM/>
</BCBSRI_FTP_GET>
<BCBSRI_FTP_GET>
<PARM>SFG_MBX</PARM>
<VALUE>/inbox/Rachel</VALUE>
<DTM/>
</BCBSRI_FTP_GET>
</CodeListValues>
</ProcessData>
I've tried many different solutions I found here, but I'm unable to get my structure to appear the way I want it to. Here's my XSLT so far:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<resultSet>
<xsl:apply-templates select="node() | @*"/>
</resultSet>
</xsl:template>
<xsl:template match="/">
<table>
<xsl:for-each select="ProcessData/CodeListValues">
<xsl:for-each select="BCBSRI_FTP_GET">
<xsl:value-of select="PARM"/>
<xsl:value-of select="VALUE"/>
<xsl:value-of select="DTM"/>
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
I need the output to follow the following pattern:
<CD>/Desktop/Rachel</CD>
<FTPProfileName>1234567890</FTPProfileName>
<DTM>yyyyMMdd</DTM>
<FileName1>Rachel.txt</FileName1>
<DTM>yyyyMMdd</DTM>
<MV/DEL>MOVE</MV/DEL>
<SFG_MBX>/inbox/Rachel</SFG_MBX>