How to group all records for an employee to one line in XSLT

25 views Asked by At

I am working on an XSLT code to generate a fixed length file output that will have multiple payment amounts for the same employee. Currently, the XSLT file is generated in a way where multiple lines will be available for the same employee if there're more than one payments for them in the same run.

Looking for an option to get the record into one line per employee. Please advise.

[![Sample record][1]][1]

<xsl:for-each select="/Export/Record">
<xsl:sort select="Last_Name"/>
<xsl:if test="Employment_Indicator='Regular' or Employment_Indicator='Executive' or Employment_Indicator='Internship'">
    <xsl:if test="EmploymentStatusID  = 'ACTIVE'">
        <xsl:if test="DeductionName = 'HSA - Self' or DeductionName = 'HSA - Family' 
 or DeductionName = 'Dependent Care - Single' or DeductionName = 'Dependent Care - Family'
 or DeductionName = 'Health Flex' or DeductionName = 'Health Flex Limited Purpose' ">
            <xsl:if test="prd_effstart !=''">
                <xsl:if test="pp_suffix = '00'">
                    <xsl:value-of select="Record_Type"/>
                    <xsl:choose>
                        <xsl:when test="Employee_Person_ID = ''">
                            <xsl:value-of select="$zeros"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="Employee_Person_ID"/>
                        </xsl:otherwise>
                    </xsl:choose>
                    <!-- <xsl:value-of select="translate(Last_Name, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> -->
                    <xsl:value-of select="concat(translate(Last_Name, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 
                                      substring($spaces, 1, 30 - string-length(Last_Name)))"/>
                    <xsl:value-of select="concat(translate(First_Name, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 
                                      substring($spaces, 1, 20 - string-length(First_Name)))"/>
                    <xsl:choose>
                        <xsl:when test="DeductionName = 'Health Flex'">
                            <xsl:value-of select="format-number(FSA * 100, '000000000000000')"/>
                        </xsl:when>
                        <xsl:when test="DeductionName = 'Health Flex Limited Purpose'">
                            <xsl:value-of select="format-number(FSALP * 100, '000000000000000')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:text/>
                        </xsl:otherwise>
                    </xsl:choose>
                    <!--Employee DCSA Contribution -->
                    <xsl:choose>
                        <xsl:when test="DeductionName = 'Dependent Care - Single'">
                            <xsl:value-of select="format-number(DCS * 100, '000000000000000')"/>
                        </xsl:when>
                        <xsl:when test="DeductionName = 'Dependent Care - Family'">
                            <xsl:value-of select="format-number(DCFM * 100, '000000000000000')"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:text/>
                        </xsl:otherwise>
                    </xsl:choose>
                    <xsl:text>&#xD;&#xA;</xsl:text>
                </xsl:if>
            </xsl:if>
        </xsl:if>
    </xsl:if>
</xsl:if>

</xsl:for-each>

0

There are 0 answers