Background - Previous Video
This is the follow-up to the previous video. URL for previous article is: https://ujwal-1664557068125.hashnode.dev/workday-xslt-replace-special-characters
YouTube Video
Online XSLT Editor
freeformatter.com/xsl-transformer.html
1. Custom Report in Wrokday
Note: I have given an example of a report from Worker Business Object. You can choose to use Candidates BO or Pre-Hires BO, so that you can solve even before the person becomes an employee.
2.XSLT: XML to Text (more appropriate for outbound integrations)
xml
<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns:ab="http://www.w3.org/TR/html4/">
<ab:Row>
<ab:Employee_ID>1001</ab:Employee_ID>
<ab:Name>Emma ©Dylan</ab:Name>
<ab:Address1>750 — Austin - Secret Lane</ab:Address1>
<ab:City>Salt Lake City</ab:City>
<ab:State>NewYork </ab:State>
<ab:email>Emma@xyz.com</ab:email>
</ab:Row>
<ab:Row>
<ab:Employee_ID>1002</ab:Employee_ID>
<ab:Name>Jam'es Tyler</ab:Name>
<ab:Address1>750 Austin Secret Lane</ab:Address1>
<ab:City>Morristown¯</ab:City>
<ab:State>Indiana</ab:State>
<ab:email>James@xyz.com</ab:email>
</ab:Row>
<ab:Row>
<ab:Employee_ID>1003</ab:Employee_ID>
<ab:Name>Oliver Parton!</ab:Name>
<ab:Address1>4186 Green Hill Road</ab:Address1>
<ab:City>Bentonville™</ab:City>
<ab:State>Arkansas</ab:State>
<ab:email>Oliver@xyz.com</ab:email>
</ab:Row>
</Root>
XSLT
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ab="http://www.w3.org/TR/html4/"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>EmplID Name email </xsl:text>
<xsl:text>
</xsl:text>
<xsl:for-each select="Root/ab:Row">
<xsl:value-of select="substring(concat(normalize-space(replace(normalize-space(ab:Employee_ID),'[^a-zA-Z0-9 ,]','')),' '),1,12)"/>
<xsl:value-of select="substring(concat(normalize-space(replace(normalize-space(ab:Name),'[^a-zA-Z0-9 ,]','')),' '),1,25)"/>
<xsl:value-of select="substring(concat(normalize-space(replace(normalize-space(ab:email),'[^a-zA-Z0-9 ,]','')),' '),1,15)"/>
<xsl:value-of select="substring(concat(normalize-space(replace(normalize-space(ab:email),'[^a-zA-Z0-9 ,@.]','')),' '),1,15)"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Output
EmplID Name email
1001 Emma Dylan Emmaxyzcom Emma@xyz.com
1002 James Tyler Jamesxyzcom James@xyz.com
1003 Oliver Parton Oliverxyzcom Oliver@xyz.com
Note: The logic to find the special characters is written using Regular Expression or Reg-Ex. I will create a dedicated video on applications of RegEx.