My input XML is as below:
<?xml version="1.0" encoding="UTF-8"?>
<PQ>
<PQGetClaimAttachment>
<USERID>XXX</USERID>
<PASSWORD>XXX</PASSWORD>
<hostAddress>XXX</hostAddress>
<businessArea>CS2XAA</businessArea>
<sourceType>2XSRCTYP</sourceType>
<operator>GT</operator>
<lookupDate>2015-01-01T00.00.00.000000+05:30</lookupDate>
</PQGetClaimAttachment>
</PQ>
I want to convert the above xml to the below one using XSLT:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<lookupInstances xmlns="http://www.tech.com/awd/rest/v1" name="XYZ">
<lookupParameters>
<lookupParameter name="businessArea">CS2XAA</lookupParameter>
<lookupParameter name="type">2XSRCTYP</lookupParameter>
<lookupParameter name="OPER">GT</lookupParameter>
<lookupParameter name="LDAT">2015-01-01T00.00.00.000000+05:30</lookupParameter>
</lookupParameters>
</lookupInstances>
I am using the following XSLT , but it's not giving me the desired output XML.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<lookupInstances xmlns="http://www.tech.com/awd/rest/v1"
name="XYZ">
<lookupParameters>
<lookupParameter businessArea="{//businessArea}" />
<lookupParameter type="{//sourceType}" />
<lookupParameter OPER="{//operator}" />
<lookupParameter LDAT="{//lookupDate}" />
</lookupParameters>
</lookupInstances>
</xsl:template>
</xsl:stylesheet>
Could any one please let me know where I am doing the mistake?