Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

XSLT Mapping issue

$
0
0

Hi ,

 

I'm working on a requirement to convert xml payload to table format .I'm getting syntax errors when tried to test it .Could you please check my code and let me know for any mistakes .

 

XML Payload:

 

<?xml version="1.0" encoding="UTF-8"?>

<ns0:PensionErrorReports xmlns:ns0="urn:XYZ:HR:PensionDetails"><FROM>XYZ@gmail.com</FROM><TO>XYZ@gmail.com</TO><Pension_ErrorReports><PayrollNumber>123</PayrollNumber><EMPLOYEE_INITIALS>Nimmagadda</EMPLOYEE_INITIALS><EDIT_NAME>Venkat</EDIT_NAME><COMMENT>testing for emp1</COMMENT><DateOfTransfer>19/03/2014</DateOfTransfer></Pension_ErrorReports><Pension_ErrorReports><PayrollNumber>345</PayrollNumber><EMPLOYEE_INITIALS>Nimmagadda</EMPLOYEE_INITIALS><EDIT_NAME>Venkat</EDIT_NAME><COMMENT>testing for emp2</COMMENT><DateOfTransfer>19/03/2014</DateOfTransfer></Pension_ErrorReports></ns0:PensionErrorReports>

 

 

XSLT Code:

 

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns0="urn:XYZ:HR:PensionDetails">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />

  <xsl:variable name="break"><br></xsl:variable>

  <xsl:variable name="tableB"><table></xsl:variable>

  <xsl:variable name="tableE"></table></xsl:variable>

  <xsl:variable name="trB"><tr></xsl:variable>

  <xsl:variable name="trE"></tr></xsl:variable>

  <xsl:variable name="tdB"><td></xsl:variable>

  <xsl:variable name="tdE"></td></xsl:variable>

  <xsl:variable name="nbsp"> </xsl:variable>

  <xsl:variable name="thB"><tr BGCOLOR="#CCCC99"></xsl:variable>

<xsl:template match="/">

<ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">

  <Subject>Error Report of ZZZZ</Subject>

<From>

  <xsl:value-of select="ns0:PensionErrorReports/FROM" />

  </From>

<To>

  <xsl:value-of select="ns0:PensionErrorReports/TO" />

  </To>

  <Content_Type>text/html</Content_Type>

<Content>

<b>

  <xsl:text>Hi Team \n\r There was an error from SAP ECC while processing IDOC for the interface <ZZZZ>. Below are the details. Please take required action immediately.</xsl:text>

  </b>

  <xsl:value-of select="$break" />

  <xsl:value-of select="$break" />

  <xsl:value-of select="$tableB" />

  <xsl:value-of select="$thB" />

  <xsl:value-of select="$tdB" />

<b>

  <xsl:text>Payroll number</xsl:text>

  </b>

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

<b>

  <xsl:text>Name</xsl:text>

  </b>

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

<b>

  <xsl:text>Formatted Name of Emp or Applicant</xsl:text>

  </b>

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

<b>

  <xsl:text>COMMENT</xsl:text>

  </b>

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

<b>

  <xsl:text>Date of Transfer</xsl:text>

  </b>

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$trE" />

<xsl:for-each select="ns0:PensionErrorReports/Pension_ErrorReports">

  <xsl:value-of select="$trB" />

  <xsl:value-of select="$tdB" />

  <xsl:value-of select="PayrollNumber" />

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

  <xsl:value-of select="EMPLOYEE_INITIALS" />

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

  <xsl:value-of select="EDIT_NAME" />

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

  <xsl:value-of select="COMMENT" />

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$tdB" />

  <xsl:value-of select="DateOfTransfer" />

  <xsl:value-of select="$nbsp" />

  <xsl:value-of select="$tdE" />

  <xsl:value-of select="$trE" />

  </xsl:for-each>

  <xsl:value-of select="$tableE" />

  <xsl:value-of select="$break" />

  <xsl:value-of select="$break" />

  </Content>

  </ns1:Mail>

  </xsl:template>

  </xsl:stylesheet>

 

 

Regards

Venkat


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>