HCM Extract - XSL Template

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

<xsl:stylesheet version="2.0" 

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

xmlns:fo="http://www.w3.org/1999/XSL/Format" 

xmlns:ora="http://www.oracle.com/XSL/Transform/java/" 

xmlns:xdofo="http://xmlns.oracle.com/oxp/fo/extensions" 

xmlns:xdoxslt="http://www.oracle.com/XSL/Transform/java/oracle.xdo.template.rtf.XSLTFunctions" 

xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"

xmlns:xdoxliff="urn:oasis:names:tc:xliff:document:1.1" 

xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:mp="http://CustomFunctions">


<xsl:output method="text" indent="yes" encoding="ISO-8859-1" />

<xsl:param name="_XDOCTX">#</xsl:param>

<xsl:function name="mp:FormatDateYYYYMMDD">

<xsl:param name="DateStr"/>

<xsl:choose>

<xsl:when test="$DateStr != ''">

<xsl:value-of select = "xdoxslt:format_date($DateStr,'yyyyMMdd','','')" />

<!--<xsl:value-of select = "xp20:format-dateTime($DateStr,'[Y0001][M01][D01]')" />-->

</xsl:when>

<xsl:otherwise>

<xsl:value-of select = "xdoxslt:rpad(' ', 8, ' ')" />

</xsl:otherwise>

</xsl:choose>

</xsl:function>

<xsl:function name="mp:StripSplChar">

<xsl:param name="string" />

<!--<xsl:variable name="AllowedSymbols" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()*%$#@!~&lt;&gt;,.?[]=- +   /\ '"/> -->

<xsl:variable name="AllowedSymbols" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 #/.,-&amp;'"/>

<xsl:value-of select="translate($string,translate($string, $AllowedSymbols, ' '),' ')"/>

</xsl:function>

<xsl:function name="mp:FormatNumberLength11">

<xsl:param name="InputNumber" />

<xsl:variable name="NumberStr" select="format-number($InputNumber,'#.00')" />

<xsl:choose>

<xsl:when test="$NumberStr = '-.00' or $NumberStr = '.00'">

<xsl:value-of select="xdoxslt:lpad('0', 11, 0)" />

</xsl:when>

<xsl:when test="contains($NumberStr, '-')">

<xsl:text>-</xsl:text>

<xsl:value-of select="xdoxslt:lpad(xdoxslt:replace(xdoxslt:replace($NumberStr, '-', '0'), '.', ''), 10, '0')" />

</xsl:when>

<xsl:otherwise>

<xsl:text>0</xsl:text>

<xsl:value-of select="xdoxslt:lpad(xdoxslt:replace($NumberStr, '.', ''), 10, '0')" />

</xsl:otherwise>

</xsl:choose>

</xsl:function>

<xsl:function name="mp:FormatNumberLength15">

<xsl:param name="InputNumber" />

<xsl:variable name="NumberStr" select="format-number($InputNumber,'#.00')" />

<xsl:choose>

<xsl:when test="$NumberStr = '-.00' or $NumberStr = '.00' ">

<xsl:value-of select="xdoxslt:lpad('0', 15, 0)" />

</xsl:when>

<xsl:when test="contains($NumberStr, '-')">

<xsl:text>-</xsl:text>

<xsl:value-of select="xdoxslt:lpad(xdoxslt:replace(xdoxslt:replace($NumberStr, '-', '0'), '.', ''), 14, '0')" />

</xsl:when>

<xsl:otherwise>

<xsl:text>0</xsl:text>

<xsl:value-of select="xdoxslt:lpad(xdoxslt:replace($NumberStr, '.', ''), 14, '0')" />

</xsl:otherwise>

</xsl:choose>

</xsl:function>

<xsl:template match = "/">

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'AsOfDate', DATA_DS/G_1/G_2/FILE_FRAGMENT/BN043/parameters/effective_date)" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'PayDate', DATA_DS/G_1/G_2/FILE_FRAGMENT/BN043/parameters/ThruDate)" />

<!-- Column Header: START -->

<xsl:text>HDR</xsl:text>

<xsl:text>&#xA;</xsl:text>

<xsl:text>&#xD;&#xA;</xsl:text>-->

<!-- Column Header: END -->

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WWA', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WWA_YTD', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WHA', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WHA_YTD', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_Match', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_UnMatch', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_ER_401k_Match', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_CatchUp', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_Match', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_UnMatch', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_Catchup', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_IC', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_IC_YTD', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_Sup_401k_Def', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_Sup_401k_Match', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_Deffered_Comp', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_Loan', number(0))" />


<!-- Detail Record: START -->

<xsl:for-each select = "DATA_DS/G_1/G_2/FILE_FRAGMENT/BN043/PPOSDG[.//Balance/RUN != '']">

<!-- Pay run details: START -->

<xsl:variable name="WWA" select="number(format-number(sum(.//Balance[BASE_BALANCE_NAME = 'WWA' and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WWA', xdoxslt:get_variable($_XDOCTX, 'Total_WWA') + $WWA)" />

<xsl:variable name="WHA" select="number(format-number(sum(.//Balance[BASE_BALANCE_NAME = 'WHA' and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WHA', xdoxslt:get_variable($_XDOCTX, 'Total_WHA') + $WHA)" />

<xsl:variable name="EE_401k_Match" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pretax 401K' 

or BASE_BALANCE_NAME = 'Pretax 401K Adj'

or BASE_BALANCE_NAME = 'Pre Tax 401k'

or BASE_BALANCE_NAME = 'Pre Tax 401k Adj'

or BASE_BALANCE_NAME = 'PR Retirement Savings'  

or BASE_BALANCE_NAME = 'PR Retirement Savings Adj') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_Match', xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_Match') + $EE_401k_Match)" />

<xsl:variable name="EE_401k_UnMatch" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pretax 401K Unmatched' 

or BASE_BALANCE_NAME = 'Pretax 401K Unmatched Adj'

or BASE_BALANCE_NAME = 'Pre Tax 401k Unmatched' 

or BASE_BALANCE_NAME = 'Pre Tax 401k Unmatched Adj' 

or BASE_BALANCE_NAME = 'PR Retirement Savings Unmatched' 

or BASE_BALANCE_NAME = 'PR Retirement Savings Adj') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_UnMatch', xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_UnMatch') + $EE_401k_UnMatch)" />

<xsl:variable name="ER_401k_Match" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pretax 401K Employer Match' 

or BASE_BALANCE_NAME = 'Pretax 401K Employer Match Adj'

or BASE_BALANCE_NAME = 'Pre Tax 401k Employer Match'

or BASE_BALANCE_NAME = 'Pre Tax 401k Employer Match Adj'

or BASE_BALANCE_NAME = 'PR Retirement Savings Employer Match' 

or BASE_BALANCE_NAME = 'PR Retirment Savings ER Match Adj') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_ER_401k_Match', xdoxslt:get_variable($_XDOCTX, 'Total_ER_401k_Match') + $ER_401k_Match)" />

<xsl:variable name="EE_401k_CatchUp" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pretax 401K Catchup' 

or BASE_BALANCE_NAME = 'Pretax 401K Catchup Adj' 

or BASE_BALANCE_NAME = 'Pre Tax 401k Catchup'

or BASE_BALANCE_NAME = 'Pre Tax 401k Catchup Adj'

or BASE_BALANCE_NAME = 'PR Retirement Savings Catchup' 

or BASE_BALANCE_NAME = 'PR Retirement Savings Catchup Adj') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_401k_CatchUp', xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_CatchUp') + $EE_401k_CatchUp)" />

<xsl:variable name="EE_Roth_Match" select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pre Tax 401k Roth') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_Match', xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_Match') + $EE_Roth_Match)" />

<xsl:variable name="ER_401k_Roth_Match" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pre Tax 401k Roth Employer Match' 

or BASE_BALANCE_NAME = 'Pre Tax 401k Roth Employer Match Adj') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_ER_401k_Match', xdoxslt:get_variable($_XDOCTX, 'Total_ER_401k_Match') + $ER_401k_Roth_Match)" />

<xsl:variable name="EE_Roth_UnMatch" select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pre Tax 401k Unmatched Roth') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_UnMatch', xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_UnMatch') + $EE_Roth_UnMatch)" />

<xsl:variable name="EE_Roth_Catchup" select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Pre Tax 401k Roth Catchup') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_EE_Roth_Catchup', xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_Catchup') + $EE_Roth_Catchup)" />

<xsl:variable name="IC" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Incentive Comp Bonus' 

or BASE_BALANCE_NAME = 'Incentive Comp Bonus X') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_IC', xdoxslt:get_variable($_XDOCTX, 'Total_IC') + $IC)" />

<!-- Pay run details: END -->

<!-- YTD details: START -->

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'YTD_Date', '')" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'WWA_YTD', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'WHA_YTD', number(0))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'IC_YTD', number(0))" />

<xsl:for-each select="BalYTDTrav/YTD_DG">

<xsl:sort select="YTD_PPRA/ActEffDT" order="descending" />

<xsl:sort select="YTD_Balance[BASE_BALANCE_NAME='WWA']/YEAR" order="descending" />

<xsl:if test="xdoxslt:get_variable($_XDOCTX, 'YTD_Date') != YTD_PPRA/ActEffDT">

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'WWA_YTD', number(format-number(YTD_Balance[BASE_BALANCE_NAME = 'WWA' and YEAR != '']/YEAR, '#.00')) + xdoxslt:get_variable($_XDOCTX, 'WWA_YTD'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'WHA_YTD', number(format-number(YTD_Balance[BASE_BALANCE_NAME = 'WHA' and YEAR != '']/YEAR, '#.00')) + xdoxslt:get_variable($_XDOCTX, 'WHA_YTD'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'IC_YTD', number(format-number(YTD_Balance[BASE_BALANCE_NAME = 'IC' and YEAR != '']/YEAR, '#.00')) + xdoxslt:get_variable($_XDOCTX, 'IC_YTD'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'YTD_Date', YTD_PPRA/ActEffDT)" />

</xsl:if>

</xsl:for-each>

<xsl:value-of select="xdoxslt:get_variable($_XDOCTX, 'WHA_YTD')" /> <xsl:text>|</xsl:text>

<xsl:value-of select="xdoxslt:get_variable($_XDOCTX, 'WWA_YTD')" /> <xsl:text>|</xsl:text>

<xsl:value-of select="xdoxslt:get_variable($_XDOCTX, 'IC_YTD')" />

<xsl:text>&#xA;</xsl:text>

<xsl:variable name="WWA_YTD" select="number(format-number(sum(.//YTD_Balance[BASE_BALANCE_NAME = 'WWA' and YEAR != '']/YEAR), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WWA_YTD', xdoxslt:get_variable($_XDOCTX, 'Total_WWA_YTD') + $WWA_YTD)" />

<xsl:variable name="WHA_YTD" select="number(format-number(sum(.//YTD_Balance[BASE_BALANCE_NAME = 'WHA' and YEAR != '']/YEAR), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_WHA_YTD', xdoxslt:get_variable($_XDOCTX, 'Total_WHA_YTD') + $WHA_YTD)" />

<xsl:variable name="IC_YTD" select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'IC_YTD') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_IC_YTD', xdoxslt:get_variable($_XDOCTX, 'Total_IC_YTD') + $IC_YTD)" />

<xsl:variable name="Loan" 

select="number(format-number(sum(.//Balance[(BASE_BALANCE_NAME = 'Loan 401k' 

or BASE_BALANCE_NAME = 'Loan 401k Puerto Rico') and RUN != '']/RUN), '#.00'))" />

<xsl:value-of select="xdoxslt:set_variable($_XDOCTX, 'Total_Loan', xdoxslt:get_variable($_XDOCTX, 'Total_Loan') + $Loan)" />

<xsl:value-of select="mp:FormatDateYYYYMMDD(xdoxslt:get_variable($_XDOCTX, 'PayDate'))" />

<xsl:value-of select = "xdoxslt:rpad(mp:StripSplChar(substring(PerTrav/PerDG/PerRec/FName,1,12)),12,' ')" />

<xsl:value-of select = "xdoxslt:rpad(mp:StripSplChar(substring(PerTrav/PerDG/PerRec/MName,1,1)),1,' ')" />

<xsl:value-of select = "xdoxslt:rpad(mp:StripSplChar(substring(PerTrav/PerDG/PerRec/LName,1,20)),20,' ')" />

<xsl:value-of select = "mp:FormatNumberLength11($WWA)" />

<xsl:value-of select = "mp:FormatNumberLength11($WWA_YTD)" />

<xsl:value-of select = "mp:FormatNumberLength11($WHA)" />

<xsl:value-of select = "mp:FormatNumberLength11($WHA_YTD)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_401k_Match)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_401k_UnMatch)" />

<xsl:value-of select = "mp:FormatNumberLength11($ER_401k_Match + $ER_401k_Roth_Match)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_401k_CatchUp)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_Roth_Match)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_Roth_UnMatch)" />

<xsl:value-of select = "mp:FormatNumberLength11($EE_Roth_Catchup)" />

<xsl:value-of select = "xdoxslt:rpad(' ',11,' ')" />

<xsl:value-of select = "xdoxslt:rpad(' ',11,' ')" />

<xsl:value-of select = "mp:FormatNumberLength11($IC)" />

<xsl:value-of select = "mp:FormatNumberLength11($IC_YTD)" />

<xsl:value-of select = "xdoxslt:rpad(' ',4,' ')" />

<xsl:value-of select = "xdoxslt:rpad(' ',1,' ')" />

<xsl:value-of select = "xdoxslt:rpad(' ',2,' ')" />

<xsl:value-of select = "xdoxslt:rpad(' ',9,' ')" />

<xsl:value-of select = "xdoxslt:rpad('0',11,'0')" />

<xsl:value-of select = "xdoxslt:rpad('0',11,'0')" />

<xsl:value-of select = "mp:FormatNumberLength11($Loan)" />

<xsl:value-of select = "xdoxslt:rpad('001',3,' ')" />

<xsl:value-of select = "xdoxslt:rpad(' ',14,' ')" />

<xsl:value-of select = "xdoxslt:rpad(.//CMP,5,' ')" />

<xsl:value-of select="xdoxslt:rpad(xdoxslt:lpad(.//PerNum,11,'0'), 30, ' ')" />

<xsl:text>&#xA;</xsl:text>

</xsl:for-each>

<!-- Detail Record: END -->

<!-- Trailer Record: START -->

<!-- 1 --><xsl:text>TRL</xsl:text>

<!-- 2 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_WWA'))" />

<!-- 3 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_WWA_YTD'))" />

<!-- 4 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_WHA'))" />

<!-- 5 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_WHA_YTD'))" />

<!-- 6 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_Match'))" />

<!-- 7 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_UnMatch'))" />

<!-- 8 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_ER_401k_Match'))" />

<!-- 9 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_401k_CatchUp'))" />

<!-- 10 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_Match'))" />

<!-- 11 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_UnMatch'))" />

<!-- 12 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_EE_Roth_Catchup'))" />

<!-- 13 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_IC'))" />

<!-- 14 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_IC_YTD'))" />

<!-- 15 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_Sup_401k_Def'))" />

<!-- 16 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_Sup_401k_Match'))" />

<!-- 17 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_Deffered_Comp'))" />

<!-- 18 --><xsl:value-of select = "mp:FormatNumberLength15(xdoxslt:get_variable($_XDOCTX, 'Total_Loan'))" />

<!-- 19 --><xsl:value-of select="xdoxslt:lpad(count(DATA_DS/G_1/G_2/FILE_FRAGMENT/BN043/PPOSDG[.//Balance/RUN != '']), 6, '0')" />

<xsl:text>&#xA;</xsl:text>

<!-- Trailer Record: END -->

</xsl:template>

</xsl:stylesheet>

No comments:

Post a Comment

Oracle HCM Cloud technical tips to grow your skills

Few information around Oracle HCM Cloud.