enter code here
<?xml version='1.0' encoding='UTF-8'?>
<peci:Workers_Effective_Stack xmlns:peci="urn:com.workday/peci">
<peci:Summary>
<peci:Integration_Event>556a0625852810035876d2d1aa340000</peci:Integration_Event>
<peci:Integration_Sent_On>2022-07-05T17:16:48.710-07:00</peci:Integration_Sent_On>
<peci:Payroll_Company_ID>CUSTOM_ORGANIZATION-6-121</peci:Payroll_Company_ID>
<peci:Payroll_Company_Name>India Payroll</peci:Payroll_Company_Name>
<peci:Payroll_Company_Code>INDPAY</peci:Payroll_Company_Code>
<peci:Pay_Group_ID>PG_India_Pay_Group</peci:Pay_Group_ID>
<peci:Pay_Group_Name>India Pay Group</peci:Pay_Group_Name>
<peci:Pay_Group_Country>IN</peci:Pay_Group_Country>
<peci:Pay_Group_Code/>
<peci:Pay_Period_Start>2022-07-01-07:00</peci:Pay_Period_Start>
<peci:Pay_Period_End>2022-07-31-07:00</peci:Pay_Period_End>
<peci:Updated_From>2022-05-05T14:45:13.000-07:00</peci:Updated_From>
<peci:Updated_To>2022-07-05T17:16:48.710-07:00</peci:Updated_To>
<peci:Effective_From>2022-07-01-07:00</peci:Effective_From>
<peci:Effective_To>2022-07-31-07:00</peci:Effective_To>
<peci:Change_Detection>Include only changes entered since the last successful
run.</peci:Change_Detection>
<peci:First_Primary_Run_of_Pay_Period>0</peci:First_Primary_Run_of_Pay_Period>
<peci:Ad_Hoc_Run>1</peci:Ad_Hoc_Run>
<peci:Full_Snapshot>0</peci:Full_Snapshot>
<peci:Worker_Count>1</peci:Worker_Count>
<peci:Version>1</peci:Version>
</peci:Summary>
<peci:Worker>
<peci:Worker_Summary>
<peci:WID>034e29aefd0e1012e7328dbe7bd30000</peci:WID>
<peci:Employee_ID>100879</peci:Employee_ID>
<peci:Name>Test India Employee</peci:Name>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>HIR</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-06-27T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-06-23T09:32:01.312-07:00</peci:Entry_Moment>
<peci:Worker_Status peci:isUpdated="1">
<peci:Status peci:isAdded="1">Active</peci:Status>
<peci:Active peci:priorValue="0">1</peci:Active>
<peci:Active_Status_Date peci:isAdded="1">2022-06-27-07:00</peci:Active_Status_Date>
<peci:Terminated>0</peci:Terminated>
<peci:Hire_Date peci:isAdded="1">2022-06-27-07:00</peci:Hire_Date>
<peci:Original_Hire_Date peci:isAdded="1">2022-06-27-07:00</peci:Original_Hire_Date>
</peci:Worker_Status>
<peci:Personal peci:isAdded="1">
<peci:Legal_Name>
<peci:First_Name>Test 0</peci:First_Name>
<peci:Last_Name>India Employee 0</peci:Last_Name>
</peci:Legal_Name>
<peci:Gender>Male</peci:Gender>
<peci:Date_of_Birth>2000-02-01-08:00</peci:Date_of_Birth>
<peci:Marital_Status>IND_Married 0</peci:Marital_Status>
<peci:Nationality>IN</peci:Nationality>
</peci:Personal>
<peci:Person_Communication peci:isUpdated="1">
<peci:Address peci:isAdded="1">
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Address_Line_1>Test 123</peci:Address_Line_1>
<peci:City>Bangalore</peci:City>
<peci:Postal_Code>125447</peci:Postal_Code>
<peci:Country>IN</peci:Country>
</peci:Address>
<peci:Email peci:isAdded="1">
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Email_Address>[email protected]</peci:Email_Address>
</peci:Email>
</peci:Person_Communication>
<peci:Person_Identification peci:isUpdated="1">
<peci:National_Identifier peci:isAdded="1">
<peci:National_ID>2454 6445 6511</peci:National_ID>
<peci:National_ID_Type>AADHAR_IN</peci:National_ID_Type>
</peci:National_Identifier>
<peci:Other_Identifier peci:isAdded="1">
<peci:Custom_ID>UNI1000074711</peci:Custom_ID>
<peci:Custom_ID_Type>UNI_ID</peci:Custom_ID_Type>
</peci:Other_Identifier>
</peci:Person_Identification>
<peci:Related_Person peci:isAdded="1">
<peci:Related_Person_ID>034e29aefd0e1012e91c7b197de60000</peci:Related_Person_ID>
<peci:Legal_Name>
<peci:First_Name>Test</peci:First_Name>
<peci:Last_Name>Father</peci:Last_Name>
</peci:Legal_Name>
</peci:Related_Person>
<peci:Related_Person peci:isAdded="1">
<peci:Related_Person_ID>034e29aefd0e1012e95cdb3029d10001</peci:Related_Person_ID>
<peci:Legal_Name>
<peci:First_Name>Test</peci:First_Name>
<peci:Last_Name>EC</peci:Last_Name>
</peci:Legal_Name>
<peci:Relationship_Type>Spouse</peci:Relationship_Type>
</peci:Related_Person>
<peci:Position peci:isAdded="1">
<peci:Business_Title>Analyst</peci:Business_Title>
<peci:Worker_Type>Regular</peci:Worker_Type>
<peci:Supervisor>
<peci:ID>100547</peci:ID>
<peci:Name>Sayuri Dimitroff Frost</peci:Name>
</peci:Supervisor>
<peci:Organization>
<peci:Organization_ID>DIV_100_Core_U_Product</peci:Organization_ID>
<peci:Organization_Type>Division</peci:Organization_Type>
<peci:Organization_Code>100</peci:Organization_Code>
<peci:Organization_Name>U Product</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>CC_9100_People</peci:Organization_ID>
<peci:Organization_Type>Cost_Center</peci:Organization_Type>
<peci:Organization_Code>9100</peci:Organization_Code>
<peci:Organization_Name>People</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>COM_Flora_Software_Systems_Private_Limited</peci:Organization_ID>
<peci:Organization_Type>Company</peci:Organization_Type>
<peci:Organization_Name>Flora Software Systems Private
Limited</peci:Organization_Name>
</peci:Organization>
</peci:Position>
<peci:Compensation peci:isAdded="1">
<peci:Compensation_Summary_in_Pay_Group_Frequency>
<peci:Total_Base_Pay>8333.33</peci:Total_Base_Pay>
<peci:Primary_Compensation_Basis>0</peci:Primary_Compensation_Basis>
<peci:Currency>INR</peci:Currency>
<peci:Frequency>Monthly</peci:Frequency>
</peci:Compensation_Summary_in_Pay_Group_Frequency>
</peci:Compensation>
<peci:Compensation_Plans peci:isAdded="1">
<peci:Bonus_Plan>
<peci:Compensation_Plan>Flora Corporate Bonus Plan</peci:Compensation_Plan>
<peci:Amount>10000</peci:Amount>
<peci:Percentage>0.1</peci:Percentage>
<peci:Currency>INR</peci:Currency>
<peci:Frequency>Annual</peci:Frequency>
<peci:Start_Date>2022-06-27-07:00</peci:Start_Date>
<peci:Compensation_Element>Flora Corporate Bonus
Plan</peci:Compensation_Element>
</peci:Bonus_Plan>
</peci:Compensation_Plans>
<peci:Payment_Election peci:isAdded="1">
<peci:Order>1</peci:Order>
<peci:Payment_Type>Direct Deposit</peci:Payment_Type>
<peci:Currency>INR</peci:Currency>
<peci:Account_Number>1342534656456</peci:Account_Number>
<peci:Account_Type>DDA</peci:Account_Type>
<peci:Bank_Name>bank</peci:Bank_Name>
<peci:Bank_ID>12345678901</peci:Bank_ID>
<peci:Distribution_Balance>1</peci:Distribution_Balance>
</peci:Payment_Election>
<peci:Additional_Information peci:isUpdated="1">
<peci:WorkerID>034e29aefd0e1012e7328dbe7bd30000</peci:WorkerID>
<ptdf:Manager_Flora_ID xmlns:ptdf="urn:com.workday/peci/tdf" peci:isAdded="1"
>UNI2404012</ptdf:Manager_Flora_ID>
<ptdf:Manager_First_Name xmlns:ptdf="urn:com.workday/peci/tdf" peci:isAdded="1"
>Sayuri</ptdf:Manager_First_Name>
<ptdf:Manager_Last_Name xmlns:ptdf="urn:com.workday/peci/tdf" peci:isAdded="1"
>Frost</ptdf:Manager_Last_Name>
<ptdf:Location xmlns:ptdf="urn:com.workday/peci/tdf" peci:priorValue="LOC_IN_Remote"
>LOC_IN_Bangalore</ptdf:Location>
</peci:Additional_Information>
</peci:Effective_Change>
<peci:Effective_Change peci:Sequence="7">
<peci:Derived_Event_Code>DTA</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-05T16:24:27.365-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-05T16:24:27.365-07:00</peci:Entry_Moment>
<peci:Worker_Status>
<peci:Status>Active</peci:Status>
<peci:Active>1</peci:Active>
<peci:Active_Status_Date>2022-06-27-07:00</peci:Active_Status_Date>
<peci:Terminated>0</peci:Terminated>
<peci:Hire_Date>2022-06-27-07:00</peci:Hire_Date>
<peci:Original_Hire_Date>2022-06-27-07:00</peci:Original_Hire_Date>
</peci:Worker_Status>
<peci:Personal>
<peci:Legal_Name>
<peci:First_Name>Test</peci:First_Name>
<peci:Last_Name>India Employee</peci:Last_Name>
</peci:Legal_Name>
<peci:Gender>Male</peci:Gender>
<peci:Date_of_Birth>2002-02-01-08:00</peci:Date_of_Birth>
<peci:Marital_Status>IND_Married</peci:Marital_Status>
<peci:Nationality>IN</peci:Nationality>
</peci:Personal>
<peci:Person_Communication>
<peci:Address>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Address_Line_1>Test 123</peci:Address_Line_1>
<peci:City>Bangalore</peci:City>
<peci:Postal_Code>125447</peci:Postal_Code>
<peci:Country>IN</peci:Country>
<peci:State_Province>Karnataka</peci:State_Province>
<peci:Usage>
<peci:Usage_Behavior_ID>Permanent</peci:Usage_Behavior_ID>
</peci:Usage>
</peci:Address>
<peci:Phone>
<peci:Usage_Type>WORK</peci:Usage_Type>
<peci:Phone_Device_Type>Landline</peci:Phone_Device_Type>
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>97674</peci:Area_Code>
<peci:Phone_Number>98765</peci:Phone_Number>
<peci:Phone_Number_With_Country_Code> 91 (97674)
98765</peci:Phone_Number_With_Country_Code>
</peci:Phone>
<peci:Phone>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Phone_Device_Type>Mobile</peci:Phone_Device_Type>
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>97887</peci:Area_Code>
<peci:Phone_Number>50987</peci:Phone_Number>
<peci:Phone_Number_With_Country_Code> 91 (97887)
50987</peci:Phone_Number_With_Country_Code>
</peci:Phone>
<peci:Email>
<peci:Usage_Type>WORK</peci:Usage_Type>
<peci:Email_Address>[email protected]</peci:Email_Address>
</peci:Email>
<peci:Email>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Email_Address>[email protected]</peci:Email_Address>
</peci:Email>
</peci:Person_Communication>
<peci:Person_Identification>
<peci:National_Identifier>
<peci:National_ID>2454 6445 6511</peci:National_ID>
<peci:National_ID_Type>AADHAR_IN</peci:National_ID_Type>
</peci:National_Identifier>
<peci:Other_Identifier>
<peci:Custom_ID>UNI1000074711</peci:Custom_ID>
<peci:Custom_ID_Type>UNI_ID</peci:Custom_ID_Type>
</peci:Other_Identifier>
</peci:Person_Identification>
<peci:Related_Person_Communication peci:isUpdated="1">
<peci:Related_Person_ID>034e29aefd0e1012e95cdb3029d10001</peci:Related_Person_ID>
<peci:Phone peci:isAdded="1">
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>72245</peci:Area_Code>
<peci:Phone_Number>68098</peci:Phone_Number>
</peci:Phone>
</peci:Related_Person_Communication>
<peci:Position>
<peci:Business_Title>Sr. HR Technology Analyst</peci:Business_Title>
<peci:Worker_Type>Regular</peci:Worker_Type>
<peci:Supervisor>
<peci:ID>100547</peci:ID>
<peci:Name>Sayuri Dimitroff Frost</peci:Name>
</peci:Supervisor>
<peci:Organization>
<peci:Organization_ID>DIV_100_Core_U_Product</peci:Organization_ID>
<peci:Organization_Type>Division</peci:Organization_Type>
<peci:Organization_Code>100</peci:Organization_Code>
<peci:Organization_Name>U Product</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>CC_9100_People</peci:Organization_ID>
<peci:Organization_Type>Cost_Center</peci:Organization_Type>
<peci:Organization_Code>9100</peci:Organization_Code>
<peci:Organization_Name>People</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>COM_Flora_Software_Systems_Private_Limited</peci:Organization_ID>
<peci:Organization_Type>Company</peci:Organization_Type>
<peci:Organization_Name>Flora Software Systems Private
Limited</peci:Organization_Name>
</peci:Organization>
</peci:Position>
<peci:Compensation>
<peci:Compensation_Summary_in_Pay_Group_Frequency>
<peci:Total_Base_Pay>8333.33</peci:Total_Base_Pay>
<peci:Primary_Compensation_Basis>0</peci:Primary_Compensation_Basis>
<peci:Currency>INR</peci:Currency>
<peci:Frequency>Monthly</peci:Frequency>
</peci:Compensation_Summary_in_Pay_Group_Frequency>
</peci:Compensation>
<peci:Payment_Election>
<peci:Order>1</peci:Order>
<peci:Payment_Type>Direct Deposit</peci:Payment_Type>
<peci:Currency>INR</peci:Currency>
<peci:Bank_Account_Name>Test Account</peci:Bank_Account_Name>
<peci:Account_Number>123456789</peci:Account_Number>
<peci:Account_Type>SA</peci:Account_Type>
<peci:Bank_Name>Indian Bank</peci:Bank_Name>
<peci:Bank_ID>IFSC1234456</peci:Bank_ID>
<peci:BIC>IDIBINBB123</peci:BIC>
<peci:Distribution_Balance>1</peci:Distribution_Balance>
</peci:Payment_Election>
<peci:Additional_Information>
<peci:WorkerID>034e29aefd0e1012e7328dbe7bd30000</peci:WorkerID>
<ptdf:Manager_Flora_ID xmlns:ptdf="urn:com.workday/peci/tdf"
>UNI2404012</ptdf:Manager_Flora_ID>
<ptdf:Manager_First_Name xmlns:ptdf="urn:com.workday/peci/tdf"
>Sayuri</ptdf:Manager_First_Name>
<ptdf:Manager_Last_Name xmlns:ptdf="urn:com.workday/peci/tdf"
>Frost</ptdf:Manager_Last_Name>
<ptdf:Location xmlns:ptdf="urn:com.workday/peci/tdf"
>LOC_IN_Bangalore</ptdf:Location>
</peci:Additional_Information>
</peci:Effective_Change>
<peci:Effective_Change peci:Sequence="5">
<peci:Derived_Event_Code>DTA</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-05T16:24:27.365-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-05T16:24:27.365-07:00</peci:Entry_Moment>
<peci:Worker_Status>
<peci:Status>Active</peci:Status>
<peci:Active>1</peci:Active>
<peci:Active_Status_Date>2022-06-27-07:00</peci:Active_Status_Date>
<peci:Terminated>0</peci:Terminated>
<peci:Hire_Date>2022-06-27-07:00</peci:Hire_Date>
<peci:Original_Hire_Date>2022-06-27-07:00</peci:Original_Hire_Date>
</peci:Worker_Status>
<peci:Personal>
<peci:Legal_Name>
<peci:First_Name>Test5</peci:First_Name>
<peci:Last_Name>India Employee5</peci:Last_Name>
</peci:Legal_Name>
<peci:Gender>Male</peci:Gender>
<peci:Date_of_Birth>2001-02-01-08:00</peci:Date_of_Birth>
<peci:Marital_Status>IND_Divorced</peci:Marital_Status>
<peci:Nationality>IN</peci:Nationality>
</peci:Personal>
<peci:Person_Communication>
<peci:Address>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Address_Line_1>Test 123</peci:Address_Line_1>
<peci:City>Bangalore</peci:City>
<peci:Postal_Code>125447</peci:Postal_Code>
<peci:Country>IN</peci:Country>
<peci:State_Province>Karnataka</peci:State_Province>
<peci:Usage>
<peci:Usage_Behavior_ID>Permanent</peci:Usage_Behavior_ID>
</peci:Usage>
</peci:Address>
<peci:Phone>
<peci:Usage_Type>WORK</peci:Usage_Type>
<peci:Phone_Device_Type>Landline</peci:Phone_Device_Type>
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>97674</peci:Area_Code>
<peci:Phone_Number>98765</peci:Phone_Number>
<peci:Phone_Number_With_Country_Code> 91 (97674)
98765</peci:Phone_Number_With_Country_Code>
</peci:Phone>
<peci:Phone>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Phone_Device_Type>Mobile</peci:Phone_Device_Type>
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>97887</peci:Area_Code>
<peci:Phone_Number>50987</peci:Phone_Number>
<peci:Phone_Number_With_Country_Code> 91 (97887)
50987</peci:Phone_Number_With_Country_Code>
</peci:Phone>
<peci:Email>
<peci:Usage_Type>WORK</peci:Usage_Type>
<peci:Email_Address>[email protected]</peci:Email_Address>
</peci:Email>
<peci:Email>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Email_Address>[email protected]</peci:Email_Address>
</peci:Email>
</peci:Person_Communication>
<peci:Person_Identification>
<peci:National_Identifier>
<peci:National_ID>2454 6445 6511</peci:National_ID>
<peci:National_ID_Type>AADHAR_IN</peci:National_ID_Type>
</peci:National_Identifier>
<peci:Other_Identifier>
<peci:Custom_ID>UNI1000074711</peci:Custom_ID>
<peci:Custom_ID_Type>UNI_ID</peci:Custom_ID_Type>
</peci:Other_Identifier>
</peci:Person_Identification>
<peci:Related_Person_Communication peci:isUpdated="1">
<peci:Related_Person_ID>034e29aefd0e1012e95cdb3029d10001</peci:Related_Person_ID>
<peci:Phone peci:isAdded="1">
<peci:International_Phone_Code>91</peci:International_Phone_Code>
<peci:Area_Code>72245</peci:Area_Code>
<peci:Phone_Number>68098</peci:Phone_Number>
</peci:Phone>
</peci:Related_Person_Communication>
<peci:Position>
<peci:Business_Title>Technology Analyst</peci:Business_Title>
<peci:Worker_Type>Regular</peci:Worker_Type>
<peci:Supervisor>
<peci:ID>100547</peci:ID>
<peci:Name>Sayuri Dimitroff Frost</peci:Name>
</peci:Supervisor>
<peci:Organization>
<peci:Organization_ID>DIV_100_Core_U_Product</peci:Organization_ID>
<peci:Organization_Type>Division</peci:Organization_Type>
<peci:Organization_Code>100</peci:Organization_Code>
<peci:Organization_Name>U Product</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>CC_9100_People</peci:Organization_ID>
<peci:Organization_Type>Cost_Center</peci:Organization_Type>
<peci:Organization_Code>9100</peci:Organization_Code>
<peci:Organization_Name>People</peci:Organization_Name>
</peci:Organization>
<peci:Organization>
<peci:Organization_ID>COM_Flora_Software_Systems_Private_Limited</peci:Organization_ID>
<peci:Organization_Type>Company</peci:Organization_Type>
<peci:Organization_Name>Flora Software Systems Private
Limited</peci:Organization_Name>
</peci:Organization>
</peci:Position>
<peci:Compensation>
<peci:Compensation_Summary_in_Pay_Group_Frequency>
<peci:Total_Base_Pay>8333.33</peci:Total_Base_Pay>
<peci:Primary_Compensation_Basis>0</peci:Primary_Compensation_Basis>
<peci:Currency>INR</peci:Currency>
<peci:Frequency>Monthly</peci:Frequency>
</peci:Compensation_Summary_in_Pay_Group_Frequency>
</peci:Compensation>
<peci:Payment_Election>
<peci:Order>1</peci:Order>
<peci:Payment_Type>Direct Deposit</peci:Payment_Type>
<peci:Currency>INR</peci:Currency>
<peci:Bank_Account_Name>Test Account</peci:Bank_Account_Name>
<peci:Account_Number>123456789</peci:Account_Number>
<peci:Account_Type>SA</peci:Account_Type>
<peci:Bank_Name>Indian Bank</peci:Bank_Name>
<peci:Bank_ID>IFSC1234456</peci:Bank_ID>
<peci:BIC>IDIBINBB123</peci:BIC>
<peci:Distribution_Balance>1</peci:Distribution_Balance>
</peci:Payment_Election>
<peci:Additional_Information>
<peci:WorkerID>034e29aefd0e1012e7328dbe7bd30000</peci:WorkerID>
<ptdf:Manager_Flora_ID xmlns:ptdf="urn:com.workday/peci/tdf"
>UNI2404012</ptdf:Manager_Flora_ID>
<ptdf:Manager_First_Name xmlns:ptdf="urn:com.workday/peci/tdf"
>Sayuri</ptdf:Manager_First_Name>
<ptdf:Manager_Last_Name xmlns:ptdf="urn:com.workday/peci/tdf"
>Frost</ptdf:Manager_Last_Name>
<ptdf:Location xmlns:ptdf="urn:com.workday/peci/tdf"
>LOC_IN_Bangalore</ptdf:Location>
</peci:Additional_Information>
</peci:Effective_Change>
</peci:Worker>
</peci:Workers_Effective_Stack>
So in this case there might be more sequence but i need to fetch the latest sequence could any help in this regard .
I tried sorting the sequence number and passing the sequence number to the attribute to get the latest row but it seems to fetch all the rows
Now i have update my xml with 3 peci sequence
CodePudding user response:
If you want to get the latest item by the attribute value "Sequence" , you can use this stylesheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:peci="urn:com.workday/peci">
<xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:template match="text()" />
<xsl:template match="/peci:Workers_Effective_Stack/peci:Worker">
<xsl:for-each select="peci:Effective_Change">
<xsl:sort select="@peci:Sequence" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="peci:Personal/peci:Legal_Name/peci:First_Name" /><xsl:text>
</xsl:text>
<xsl:value-of select="peci:Personal/peci:Legal_Name/peci:Last_Name" /><xsl:text>
</xsl:text>
<xsl:value-of select="peci:Personal/peci:Date_of_Birth" /><xsl:text>
</xsl:text>
<xsl:value-of select="peci:Personal/peci:Marital_Status" /><xsl:text>
</xsl:text>
<xsl:value-of select="peci:Position/peci:Business_Title" /><xsl:text>
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Its output is
Test
India Employee
2002-02-01-08:00
IND_Married
Sr. HR Technology Analyst
This stylesheet could be simplified by using higher versions like XSLT-2.0 or XSLT-3.0, but you did not specify that you can use these versions, so I assumed the lowest common denominator.
CodePudding user response:
if you need max Sequence = 7
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:peci="urn:com.workday/peci" exclude-result-prefixes="peci">
<xsl:variable name="maxseq" select="max(.//peci:Effective_Change/@peci:Sequence)"/>
<!-- <xsl:variable name="lastseq" select="(.//peci:Effective_Change/@peci:Sequence)[last()]"/>-->
<xsl:template match="/">
<xsl:apply-templates select=".//peci:Effective_Change[@peci:Sequence=$maxseq]"/>
</xsl:template>
<xsl:template match="peci:Effective_Change[@peci:Sequence=$maxseq]">
<First_Name><xsl:value-of select="peci:Personal/peci:Legal_Name/peci:First_Name"/></First_Name>
<Last_Name><xsl:value-of select="peci:Personal/peci:Legal_Name/peci:Last_Name"/></Last_Name>
<Date_of_Birth><xsl:value-of select="peci:Personal/peci:Date_of_Birth"/></Date_of_Birth>
<Marital_Status><xsl:value-of select="peci:Personal/peci:Marital_Status"/></Marital_Status>
<Business_Title><xsl:value-of select="peci:Position/peci:Business_Title"/></Business_Title>
</xsl:template>
</xsl:stylesheet>
it'll produce
<First_Name>Test</First_Name>
<Last_Name>India Employee</Last_Name>
<Date_of_Birth>2002-02-01-08:00</Date_of_Birth>
<Marital_Status>IND_Married</Marital_Status>
<Business_Title>Sr. HR Technology Analyst</Business_Title>
if you need last Sequence = 5 then uncomment the variable lastseq declaration and change maxseq in the code to it and it'll produce
<First_Name>Test5</First_Name>
<Last_Name>India Employee5</Last_Name>
<Date_of_Birth>2001-02-01-08:00</Date_of_Birth>
<Marital_Status>IND_Divorced</Marital_Status>
<Business_Title>Technology Analyst</Business_Title>