Skip to content

Instantly share code, notes, and snippets.

@r4hulp
Created July 13, 2026 19:38
Show Gist options
  • Select an option

  • Save r4hulp/72e56d4098ec4f265c41db4bbc5ce7a1 to your computer and use it in GitHub Desktop.

Select an option

Save r4hulp/72e56d4098ec4f265c41db4bbc5ce7a1 to your computer and use it in GitHub Desktop.
Txtfixedwidthfinal
<?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="&#13;&#10;">
<xsl:for-each select="/ws:Worker_Sync/ws:Worker">
<Record>
<!-- =================================================
1. Employee ID – length 10
================================================= -->
<Employee_ID
xtt:fixedLength="10"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Summary/ws:Employee_ID
)"/>
</Employee_ID>
<!-- =================================================
2. Legal First Name – length 20
================================================= -->
<Legal_First_Name
xtt:fixedLength="20"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Personal/
ws:Name_Data/
ws:First_Name
)"/>
</Legal_First_Name>
<!-- =================================================
3. Legal Last Name – length 20
================================================= -->
<Legal_Last_Name
xtt:fixedLength="20"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Personal/
ws:Name_Data/
ws:Last_Name
)"/>
</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) &gt;= 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
Confirmed from the current Worker Sync XML:
Personal / Address_Data / Country
================================================= -->
<Home_Address_Country
xtt:fixedLength="2"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Personal/
ws:Address_Data/
ws:Country
)"/>
</Home_Address_Country>
<!-- =================================================
6. Work Location Country – Alpha-2, length 2
================================================= -->
<Work_Location_Country
xtt:fixedLength="2"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Position/
ws:Business_Site_Country
)"/>
</Work_Location_Country>
<!-- =================================================
7. Job Profile – length 15
================================================= -->
<Job_Profile
xtt:fixedLength="15"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Position/ws:Job_Profile
)"/>
</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) &gt;= 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
================================================= -->
<Manager_ID
xtt:fixedLength="10"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Position/
ws:Supervisor/
ws:Supervisor_ID
)"/>
</Manager_ID>
<!-- =================================================
10. Cost Center – length 10
Confirmed from current Worker Sync XML:
Position / Organization_Data / Organization_Name
================================================= -->
<Cost_Center
xtt:fixedLength="10"
xtt:align="left"
xtt:paddingCharacter=" "
xtt:severity="warning">
<xsl:value-of
select="normalize-space(
ws:Position/
ws:Organization_Data/
ws:Organization_Name
)"/>
</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