Created
July 13, 2026 20:28
-
-
Save r4hulp/a5619960f5c1b48599ceadd2462486f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet | |
| version="2.0" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:ws="urn:com.workday/workersync" | |
| xmlns:xtt="urn:com.workday/xtt" | |
| exclude-result-prefixes="xsl ws"> | |
| <xsl:output | |
| method="xml" | |
| encoding="UTF-8" | |
| omit-xml-declaration="yes"/> | |
| <xsl:template match="/"> | |
| <!-- Each Record becomes one line in the TXT --> | |
| <File xtt:separator=" "> | |
| <xsl:for-each select="/ws:Worker_Sync/ws:Worker"> | |
| <!-- ================================================= | |
| Store the source values once | |
| ================================================= --> | |
| <xsl:variable | |
| name="employeeID" | |
| select="normalize-space( | |
| ws:Summary/ws:Employee_ID | |
| )"/> | |
| <xsl:variable | |
| name="legalFirstName" | |
| select="normalize-space( | |
| ws:Personal/ | |
| ws:Name_Data/ | |
| ws:First_Name | |
| )"/> | |
| <xsl:variable | |
| name="legalLastName" | |
| select="normalize-space( | |
| ws:Personal/ | |
| ws:Name_Data/ | |
| ws:Last_Name | |
| )"/> | |
| <xsl:variable | |
| name="homeAddressCountry" | |
| select="normalize-space( | |
| ws:Personal/ | |
| ws:Address_Data/ | |
| ws:Country | |
| )"/> | |
| <xsl:variable | |
| name="workLocationCountry" | |
| select="normalize-space( | |
| ws:Position/ | |
| ws:Business_Site_Country | |
| )"/> | |
| <xsl:variable | |
| name="jobProfile" | |
| select="normalize-space( | |
| ws:Position/ws:Job_Profile | |
| )"/> | |
| <xsl:variable | |
| name="managerID" | |
| select="normalize-space( | |
| ws:Position/ | |
| ws:Supervisor/ | |
| ws:Supervisor_ID | |
| )"/> | |
| <xsl:variable | |
| name="costCenter" | |
| select="normalize-space( | |
| ws:Position/ | |
| ws:Organization_Data/ | |
| ws:Organization_Name | |
| )"/> | |
| <Record> | |
| <!-- ================================================= | |
| 1. Employee ID – length 10 | |
| ================================================= --> | |
| <xsl:if test="string-length($employeeID) > 10"> | |
| <Employee_ID_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Employee ID exceeds maximum length of 10. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Employee_ID_Warning> | |
| </xsl:if> | |
| <Employee_ID | |
| xtt:fixedLength="10" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$employeeID"/> | |
| </Employee_ID> | |
| <!-- ================================================= | |
| 2. Legal First Name – length 20 | |
| ================================================= --> | |
| <xsl:if test="string-length($legalFirstName) > 20"> | |
| <Legal_First_Name_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Legal First Name exceeds maximum length of 20. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Legal_First_Name_Warning> | |
| </xsl:if> | |
| <Legal_First_Name | |
| xtt:fixedLength="20" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$legalFirstName"/> | |
| </Legal_First_Name> | |
| <!-- ================================================= | |
| 3. Legal Last Name – length 20 | |
| ================================================= --> | |
| <xsl:if test="string-length($legalLastName) > 20"> | |
| <Legal_Last_Name_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Legal Last Name exceeds maximum length of 20. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Legal_Last_Name_Warning> | |
| </xsl:if> | |
| <Legal_Last_Name | |
| xtt:fixedLength="20" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$legalLastName"/> | |
| </Legal_Last_Name> | |
| <!-- ================================================= | |
| 4. Date of Birth – DDMMYYYY, field length 10 | |
| Two spaces will be added after the 8-character date | |
| ================================================= --> | |
| <Date_of_Birth | |
| xtt:fixedLength="10" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:variable | |
| name="birthDate" | |
| select="normalize-space( | |
| ws:Personal/ws:Birth_Date | |
| )"/> | |
| <xsl:choose> | |
| <xsl:when test=" | |
| string-length($birthDate) >= 10 | |
| and substring($birthDate, 5, 1) = '-' | |
| and substring($birthDate, 8, 1) = '-' | |
| "> | |
| <xsl:value-of | |
| select="concat( | |
| substring($birthDate, 9, 2), | |
| substring($birthDate, 6, 2), | |
| substring($birthDate, 1, 4) | |
| )"/> | |
| </xsl:when> | |
| <xsl:otherwise/> | |
| </xsl:choose> | |
| </Date_of_Birth> | |
| <!-- ================================================= | |
| 5. Home Address Country – Alpha-2, length 2 | |
| ================================================= --> | |
| <xsl:if test="string-length($homeAddressCountry) > 2"> | |
| <Home_Address_Country_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Home Address Country exceeds maximum length of 2. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Home_Address_Country_Warning> | |
| </xsl:if> | |
| <Home_Address_Country | |
| xtt:fixedLength="2" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$homeAddressCountry"/> | |
| </Home_Address_Country> | |
| <!-- ================================================= | |
| 6. Work Location Country – Alpha-2, length 2 | |
| ================================================= --> | |
| <xsl:if test="string-length($workLocationCountry) > 2"> | |
| <Work_Location_Country_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Work Location Country exceeds maximum length of 2. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Work_Location_Country_Warning> | |
| </xsl:if> | |
| <Work_Location_Country | |
| xtt:fixedLength="2" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$workLocationCountry"/> | |
| </Work_Location_Country> | |
| <!-- ================================================= | |
| 7. Job Profile – length 15 | |
| ================================================= --> | |
| <xsl:if test="string-length($jobProfile) > 15"> | |
| <Job_Profile_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Job Profile exceeds maximum length of 15. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Job_Profile_Warning> | |
| </xsl:if> | |
| <Job_Profile | |
| xtt:fixedLength="15" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$jobProfile"/> | |
| </Job_Profile> | |
| <!-- ================================================= | |
| 8. Hire Date – DDMMYYYY, length 8 | |
| ================================================= --> | |
| <Hire_Date | |
| xtt:fixedLength="8" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:variable | |
| name="hireDate" | |
| select="normalize-space( | |
| ws:Status/ws:Hire_Date | |
| )"/> | |
| <xsl:choose> | |
| <xsl:when test=" | |
| string-length($hireDate) >= 10 | |
| and substring($hireDate, 5, 1) = '-' | |
| and substring($hireDate, 8, 1) = '-' | |
| "> | |
| <xsl:value-of | |
| select="concat( | |
| substring($hireDate, 9, 2), | |
| substring($hireDate, 6, 2), | |
| substring($hireDate, 1, 4) | |
| )"/> | |
| </xsl:when> | |
| <xsl:otherwise/> | |
| </xsl:choose> | |
| </Hire_Date> | |
| <!-- ================================================= | |
| 9. Manager ID – length 10 | |
| ================================================= --> | |
| <xsl:if test="string-length($managerID) > 10"> | |
| <Manager_ID_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Manager ID exceeds maximum length of 10. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Manager_ID_Warning> | |
| </xsl:if> | |
| <Manager_ID | |
| xtt:fixedLength="10" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$managerID"/> | |
| </Manager_ID> | |
| <!-- ================================================= | |
| 10. Cost Center – length 10 | |
| ================================================= --> | |
| <xsl:if test="string-length($costCenter) > 10"> | |
| <Cost_Center_Warning | |
| xtt:omit="true" | |
| xtt:severity="warning" | |
| xtt:message="{concat( | |
| 'WARNING: Employee ', | |
| $employeeID, | |
| ' Cost Center exceeds maximum length of 10. Value truncated.' | |
| )}"> | |
| <xsl:text>Warning</xsl:text> | |
| </Cost_Center_Warning> | |
| </xsl:if> | |
| <Cost_Center | |
| xtt:fixedLength="10" | |
| xtt:align="left" | |
| xtt:paddingCharacter=" " | |
| xtt:severity="warning"> | |
| <xsl:value-of select="$costCenter"/> | |
| </Cost_Center> | |
| </Record> | |
| </xsl:for-each> | |
| </File> | |
| </xsl:template> | |
| </xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment