I need to do transformation from PCDATA in XML into another XML. Can any one help me on this?
I need to map the line of business, site-location and policy number from the request to the corresponding field in response.
Input XML containing PCDATA which is escaped XML:
<ns2:Response xmlns:ns2="http://webservices.company.com/">
<return><ibdoc><result lob='15' env_def='SR_JBOSS_DEV' gen_date='2017-01-18 12:11:30 AM' ibdoc_version='3.1' engine_type='JBoss' site_location='S396AT092'>
<program parent_id='1001' program_id='1' program_ver='1' package_date='2017-01-05T13:06:01' status='PASS' gen_type='0' region_format='en-US' from_cache='true'>
<c i='0' d='Policy'>
<m i='POLICY NUMBER' d='POLICY NUMBER' v='1000001'/>
</c>
</program>
<stats>
<start_time>2017-01-18 12:11:30:0191 AM</start_time>
<stop_time>2017-01-18 12:11:30:0226 AM</stop_time>
<running_time>35</running_time>
<xml_walking>31</xml_walking>
</stats>
</result></ibdoc></return>
</ns2:Response>
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<ns2:custom-response xmlns:ns2="http://esbservices.company.com/">
</ns2:custom-response>
</xsl:template>
</xsl:stylesheet>
Expected Output XML:
<ns2:custom-response xmlns:ns2="http://esbservices.company.com/">
<line-of-business>15</line-of-business>
<site>S396AT092</site>
<policy>
<policy-nr>1000001</policy-nr>
</policy>
</ns2:custom-response>