0% found this document useful (0 votes)
103 views

Code XSLT Transformation - pdf0

The document provides instructions for creating an XSLT transformation. It includes a sample source code for the transformation that contains templates to delete self-contained elements if they are empty. Developers are instructed to save and activate the transformation after adding the provided code.

Uploaded by

usshahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

Code XSLT Transformation - pdf0

The document provides instructions for creating an XSLT transformation. It includes a sample source code for the transformation that contains templates to delete self-contained elements if they are empty. Developers are instructed to save and activate the transformation after adding the provided code.

Uploaded by

usshahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Creation steps of the XSLT transformation are available in the

attached PDF Implementation Guideline. After creating the


transformation put the source code as mentioned below:
Source Code for the XSLT transformation CGI_XML_CT_XSLT:
The first 3-4 lines (marked in bold) and the last line (also marked in bold)
of the below code will be automatically present in your source code. So just
put the code carefully.
After putting the code, save the transformation as well as activate it.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="ht
tp://www.sap.com/sapxsl" version="1.0">

<xsl:strip-space elements="*"/>

<xsl:template match="/">
</xsl:template>

<!--Delete self-contained elements -->
<xsl:template match="InitgPty">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="PmtTpInf">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="SvcLvl">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="LclInstrm">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CtgyPurp">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="OrgId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="SchmeNm">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CtctDtls">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="DbtrAcct">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Othr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Tp">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="DbtrAgt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="FinInstnId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="ClrSysMmbId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="PstlAdr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="BrnchId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="ChrgsAcct">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="EqvtAmt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="ChqInstr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="DlvryMtd">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="UltmtDbtr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="IntrmyAgt1">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CdtrAgt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="ClrSysId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CdtrAgtAcct">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Cdtr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="PrvtId">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="DtAndPlcOfBirth">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CdtrAcct">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="UltmtCdtr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="InstrForCdtrAgt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="InstrForDbtrAgt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Purp">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="RgltryRptg">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Authrty">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Dtls">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Tax">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Cdtr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Dbtr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Authstn">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Rcrd">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Prd">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="FrToDt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="TaxAmt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="RltdRmtInf">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="RmtLctnPstlAdr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Adr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>

<xsl:template match="RmtInf">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="RfrdDocInf">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CdOrPrtry">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="RfrdDocAmt">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="AdjstmntAmtAndRsn">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="CdtrRefInf">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Invcr">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>


<xsl:template match="Invcee">
<xsl:if test="*[.!='']">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>

<xsl:template match="*" mode="copy-unless-empty">
<xsl:if test="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:apply-templates mode="copy-unless-empty"/>


<xsl:template match="*" priority="-2">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

</xsl:transform>

You might also like