XSLT
XSLT
�
EDUCATION
© 2021 This manual contains confidential information and is solely for educational purposes. Any reproduction or distribution of
these materials is prohibited. Workday, Inc. WORKDAY and the WORKDAY Logo are trademarks of Workday, Inc, registered in the
United States and elsewhere. Additional brand and product names in this text are trademarks or registered trademarks of their
respective holders. Version 2021 R2 (September 2021)
Ill Bookshelf About Support -
- - -
-- �
- _ _ ______
_
My Library XSLT for Workday X
:=: Contents Q.
Workday Pro
Adoption Kit
A series of online demonstrations that show Workday in action and provide tips on
deploying features.
Enablement Workshops
Learn In-Person
:::: Contents
<
XSLT for Workday
Learn Remote
Online attendance to a live Learn In-Person course. Through your webcam, you
can interact with the instructor and other students as if you were in the classroom.
ill
Learn Virtual
Online, live instructor-led training including hands-on activities in a Workday
training tenant. The instructor and all students participate virtually.
[O
Learn Independent
Online training that combines engaging videos and interactive activities that offer
the flexibility to complete our most popular courses at your own pace.
Learn On-Demand
Libraries of short, topic-specific videos and job aids that supplement instructor-led
training as well as serve as a refresher on concepts learned in class for on-the-job
support.
EBOOK BASICS
Workday Education hosts course manuals on VitalSource® Bookshelf. Access your course
manual online or download the Bookshelf App for offline viewing. Visit Get Started with eBooks
on Workday Community to learn more about eBooks.
From the reading pane, click and drag to select text. In the pop-up that appears, you can select
a highlight color, add a note, create a flashcard, and hear the selected text read aloud.
T he table below shows the feature and navigation icons in the eBook. You may notice slight
variations depending on whether you access the eBook through your browser or Bookshelf
app:
II Table of View or hide the Table of Contents in the left-side navigation pane.
Contents
Ci] Search Enter a term in the Search Contents field to search the Table of
Contents. Search the entire course manual by clicking the Search icon
and entering a term or phrase in the Search field.
� Highlight Text From the reading pane, click and drag to select text. When you
highlight the text, a pop-up appears. Select a highlighter color. To view
your highlighted text, in the left-side navigation pane, select the
Notebook icon.
1 � Bookmark Navigate to the page to save. At the lower-left corner, click the
Bookmark icon. To view all stored bookmarks, click the Bookmark icon
in the left-side navigation pane or the up-arrow at the bottom of the
page. Click any bookmark to navigate to that page.
LIi Flashcards View your flashcard decks, edit your current cards, or create a new
flashcard from scratch.
cg, Print From the menu bar, click the Print icon. To prevent printing errors, limit
the print range to 50 or fewer pages at a time.
�• Read Aloud Click the Read Aloud icon to hear the text read from the top of the
current page. To stop, click the Pause icon on the bottom of the screen.
CONTENTS
Description................................................................................................................................ 9
Objectives ................................................................................................................................. 9
Agenda......................................................................................................................................9
Overview................................................................................................................................. 11
Objectives................................................................................................................................11
What is XML?.......................................................................................................................... 11
XML in Workday................................................................................................................... 11
RaaS Configuration............................................................................................................. 13
Overview ................................................................................................................................. 19
Objectives............................................................................................................................... 19
What is XSLT?........................................................................................................................ 19
XSLT in Workday................................................................................................................. 19
XSLT Structure........................................................................................................................20
XSLT Namespace................................................................................................................ 20
XSLT Templates...................................................................................................................21
Configure Transform............................................................................................................ 22
Overview................................................................................................................................. 27
Objectives............................................................................................................................... 27
XPath Usages......................................................................................................................... 27
XPath Expressions.................................................................................................................. 28
XPath Attributes...................................................................................................................... 28
XPath Predicates.................................................................................................................... 28
XPath Axes............................................................................................................................. 29
Symbols in XPath....................................................................................................................29
Xpath Functions...................................................................................................................... 32
XSLT 3.0................................................................................................................................. 70
On-no-match Attribute......................................................................................................... 71
Burst Mode..............................................................................................................................74
Iterate Feature........................................................................................................................ 77
Accumulator Feature...............................................................................................................77
Appendix B - Resources........................................................................................................... 81
Notepad ++............................................................................................................................. 81
DESCRIPTION
This course is designed for integration developers who are responsible for building and
maintaining Workday integration systems.
Through hands-on activities, you will learn how to write XSLT style sheets to transform custom
reports, external files, and web service responses to meet external requirements. You will learn
the structure of XML and how to write XPath statements. Throughout the course, you will
practice using XSLT templates and applying various XSLT elements including conditional logic,
custom functions, and formatting. You will learn the benefits of XSLT 3.0 and how to use
streaming for high volume integrations.
Course activities use the Enterprise Interface Builder (EIB) integration tool, primarily EIBs with
custom reports. However, the course is foundational for developing both Core Connector with
Document Transformation integrations and Workday Studio integrations.
OBJECTIVES
AGENDA
Day 1:
Day 2:
OVERVIEW
This chapter distinguishes Extensible Markup Language (XML) in Workday and provides
recommendations for configuring a Report-as-a-Service.
OBJECTIVES
WHAT IS XML?
XML, or extensible Markup Language, is a computer language that uses tags to describe and
carry data. Each application using XML defines its own tags.
XML STRUCTURE
XML must be well formed, meaning it must adhere to some basic requirements of all
XML files. There is a single root element that contains all other elements. Elements are nested,
containing text or other elements between begin and end tags. Elements can also contain
attributes, which appear as name="value" pairs within begin tags.
An XML document may also need to adhere to rules defined for an application, often provided
as an XML schema definition (XSD). A valid XML file satisfies these rules and is well formed.
XML IN WORKDAY
Workday integrations rely on RaaS reports or web services to receive or send data. By default,
a RaaS report or web service in an integration stores the data in XML.
RaaS reports store data in two XML formats: Workday XML and Simple XML.
Note: In addition to Workday XML or Simple XML, you can output Workday reports
in alternate formats that better support Microsoft Excel and other applications.
Workday XML
Workday XML for a custom report includes report data and integration IDs. The wd:Report_Data
root element contains a list of wd:Report_Entry elements. Each wd:Report_Entry contains a list
of other elements, which correspond to fields defined in the report.
For example:
Simple XML
For example:
</wd:Report_Entry>
</wd=Report_Data>
RAAS CONFIGURATION
f@l
ACTIVITY 1.1 - CREATE POSITIONS EIB WITH A
� CUSTOM REPORT
: Business Case: Create an outbound EIB using a custom report as the data source.
5. Click OK.
6. Click Next to accept the default General Settings and move to the Data Source section.
7. In the Custom Report field, select the WDINST RW EIB Positions with RBOs report.
8. Click Next.
9. Click Next to skip the Transform section and move to the Deliver section.
2. Launch the EIB to run now and enter the following values for the report prompts:
Field Name Entry Value
3. Click OK.
There are two types of Workday report fields: simple types such as text, numeric or date
formats, and instance types, such as single instance or multi-instance. The two field
types display differently in both XML format and the UI.
For example, the instance field Location shown below displays in XML with two ID types, the
WID and a Reference ID. Additionally, the location value, San Francisco, is in an attribute.
• Follow a consistent naming pattern for XML aliases, e.g. use underscores for spaces or
capitalize all words.
• Use a simple type field when possible unless only an instance type field contains the
value you need (from the Descriptor or an ID type).
Business Case: Modify the custom report configuration for your EIB to ensure it follows design
recommendations. Then, view the XML and evaluate if you formatted lhe data as much as
possible before writing an XSLT file.
1. Navigate to the WDINST RW EIB Positions with RBOs custom report and select its
Related Actions and then Custom Report> Edit.
2. Update the Column Heading Override XML Alias fields so they match lhe values below:
Field Column Heading Override XML Alias
2. Select the report's Related Actions and then Web Service> View URLs.
4. Select the Workday XML link. The XML will open in a new tab. Note that you may need
to enter your login details again.
7. Open the XML file in a text editor. Format and wrap the XML so that you can view the
structure more easily. Note that the method lo format and wrap the XML will vary
depending on lhe text editor.
Business Case: Modify the custom report configuration for your EIB to ensure it follows design
recommendations. Then, view the XML and evaluate if you formatted the data as much as
possible before writing an XSLT file.
1. Navigate to the WDINST RW EIB Positions with RBOs custom report and select its
Related Actions and then Custom Report > Edit.
2. Update the Column Heading Override XML Alias fields so they match the values below:
Field Column Heading Override XML Alias
2. Select the report's Related Actions and then Web Service > View URLs.
4. Select the Workday XML link. The XML will open in a new tab. Note that you may need
to enter your login details again.
7. Open the XML file in a text editor. Format and wrap the XML so that you can view the
structure more easily. Note that the method to format and wrap the XML will vary
depending on the text editor.
A. Why do some Report Entry nodes include the Worker_Detail section, while other
Report Entry nodes do not?
D. Where does the Restrictions_Location node display the name of the location?
ACTIVITY ANSWERS
8A. Why do some Report Entry nodes include the Worker_Detail section, while other Report
Entry nodes do not? If the position is filled, there is worker data to output. Positions that are
available do not have associated worker data.
8B. What three pieces of information does the Worker field output? Worker, Location, and Type
8C. Which fields output their associated IDs? Restrictions Location, Restrictions Type, and
then also the following fields using the Worker object: Worker, Location, Type
80. Where does the Restrictions_Location node display the name of the location? Location ID
and the Descriptor
8E. What is the date format of the Availability_Date field? YYYY-MM-OO-hh:mm, for
example 2021-02-04-08:00
OVERVIEW
This chapter introduces Extensible Stylesheet Language Transformation and explains its
structure and processing method. You will begin writing XSLT for an outbound EIB with
a custom report.
OBJECTIVES
WHAT IS XSLT?
EXtensible Stylesheet Language Transformation (XSLT) transforms XML documents into new
XML documents or other formats such as a delimited or fixed-width text file. You can use XSLT
to:
,i'
• Add headers and footers.
1 ', Tut XSLT files end with ".xsl". You may hear XSLT referred to as an XSL file or an
- XSL style sheet.
, ...
XSLT IN WORKDAY
Use XSLT in Workday to transform the output of an EIB, connector, or Workday Studio
integration.
Note: Consider the run-time limit for each integration tool and the processing time
to process the XSLT:
• EIB has a two-hour processing time limit for the transformation.
• Workday Studio has a two-hour processing limit for the entire integration.
• Document Transformation has a 30-hour processing limit.
XSLT STRUCTURE
All XS.LT files must contain a root element, namespace, and at least one template.
A root element (either xsl:stylesheet or xsl:transform) declares the document as an XSLT style
sheet. It is the root of the tree structure and contains all other elements.
XSLT NAMESPACE
XSLT for Workday
Note: Consider the run-time limit for each integration tool and the processing time
to process the XSLT:
• EIB has a two-hour processing time limit for the transformation.
• Workday Studio has a two-hour processing limit for the entire integration.
• Document Transformation has a 30-hour processing limit.
XSLT STRUCTURE
All XSLT files must contain a root element, namespace, and at least one template.
A root element (either xsl:stylesheet or xsl:transform) declares the document as an XSLT style
sheet. It is the root of the tree structure and contains all other elements.
XSLT NAMESPACE
An XSLT namespace contains a list of elements that you can use in your code.
Namespaces define the scope of XSLT elements to avoid naming conflicts with other XSLT
namespaces or XML elements. Refer to a namespace by its prefix. The XSL namespace, http://
www.w3.org/1999/XSL/Transform, contains the default XSLT elements.
Each element in the body of the style sheet has a prefix that indicates which namespace it
refers to. Include all namespaces the elements use in the style sheet header, as an attribute
of the root element. For Workday, all style sheets should typically contain:
Important: Ensure the style sheet references the namespace from the source XML.
If the namespace does not match, it does not apply a transformation. You can view
a custom report namespace in the custom report settings in the Advanced tab.
Ensure that unused namespaces are not output on the root element of your XML file.
To prevent unused namespaces from appearing, include one of the following statements in the
<xsl:stylesheet> declaration.
XSLT TEMPLATES
T he <xsl: template> element contains rules to apply to a specified XML node. It says, "For
all the elements in this node, do this."
If an XSLT processor was a person, here is how they would describe their job:
"People provide me with an XSLT file that contains instructions on how to transform an XML
document. To begin, I start reading the XML document. As I read each node, I check if there is a
corresponding template in the XSLT. If there is, I follow the instructions in the template. The
template may instruct me to output a new XML root element or pull data from the XML. It often
references other templates in the XSLT or instructs me to perform an action on each element,
one at a time. I output the results for each template as I go, until I finish the instructions for all
the templates."
Run the Create XSLT Attachment Transformation task to upload a transformation style sheet to
use with an EIB.
CONFIGURE TRANSFORM
To use an XSLT attachment for an EIB, set the EIB's Transformation Type to Custom
Transformation. Then, in the Custom Transformation field, select your uploaded XSLT
attachment.
If you make changes to the stylesheet outside of Workday, run the Edit XSLT Attachment
Transformation task to upload the new version to the existing object. You do not need to edit the
integration system itself.
When you transform large amounts of data, ElBs with custom XSLT transformations can use
much more memory than the source data requires. For an EIB transformation, the maximum
amount of memory is 27 GB.
Resource: For more information, view the Manage Outbound EIBs with Custom
XSLTs page on Workday Community.
Business Case: The WICT EIB Positions integration system should produce an XML output
file that follows the formatting below, with a <position> node for each position. The existing
XSLT file for the integration system has unresolved issues. Fix the issues and test the
integration with the new XSLT file.
<positions>
<position>
<position_ID>Position ID</position_ID>
<title>Position Title</title>
</position>
: <positions>
2. The XSLT file states three issues in the comments. Locate each issue and fix it.
A. Issue #1: The XSLT namespace does not match the report namespace.
B. Issue #2: The template declaration is incomplete. Add a "match" attribute that
matches on the root node (indicated by either "/" or "wd:Report_Data").
3. Save your changes. (Note: View the positions_issues_answer.xsl file for the answers.)
4. Click Select Files and upload your updated XSLT file. Click OK.
6. Select the integration system's Related Actions and then Enterprise Interface > Edit.
9. In the Custom Transformation field, select the WICT Positions EIB XSLT file.
10. Click Review and Submit in the left pane. Click OK.
11. Select the integration system's Related Actions and then Integration > Launch /
Schedule.
15. When the integration completes, select the Output Files tab.
1. To edit the XSLT file used in the EIB transformation, run the Edit XSLT Attachment
Transformation task. Note that you could run the task in a separate tab so you can
leave the EIB in the original tab.
3. Click OK.
7. Click OK.
I @ Activity Complete I
XSLT for Workday
I 0 Activity Complete I
OVERVIEW
This chapter introduces XML Path Language (XPath}, a crucial component of an XSLT style
sheet. You will practice writing XPath statements and use components such as axes and
predicates.
OBJECTIVES
WHAT IS XPATH?
XPath, or XML Path Language, uses directory-like notation to refer to elements in the input
XML. The notation is similar to the file path of a file on your computer.
XPath indicates which node to apply instructions to. Without XPath, an XSLT file could read the
source XML but could not do anything with specific nodes.
XPATH USAGES
Use XPath in a template match attribute. For example, this XPath instructs the template to run
the instructions on the Report Entry node, found in Report Data. All of the text inside quotes is
an XPath expression.
<xsl:template match="/wd:Report_Data/wd:Report_Entry">
<xsl:value-of select="/wd:Report_Data/wd:Report_Entry/
wd:Employee_ID"/>
<xsl:for-each select="/wd=Report_Data/wd=Report_Entry"/>
<xsl:apply-templates select="/wd=Report_Data/wd=Report_Entry"/>
XPATH EXPRESSIONS
An absolute path starts with a forward slash and contains directions starting from the root node,
such as:
"/wd:Report_Data/wd:Report_Entry/wd:Worker_Detail/wd:Worker"
A relative path contains directions to one or more nodes relative to the processor's current
position. It does not lead with a forward slash. For example:
"wd:Report_Entry/wd:worker_Detail/wd:worker"
Important: View the w3schools XPath Syntax page for more information on
�
referring to absolute and relative paths.
�
XPATH ATTRIBUTES
The @ symbol directs XPath to select the value of an element's attribute. For example, the
following statement selects the value of the descriptor attribute off the wd:location element.
<xsl:value-of select="wd:location/@wd:Descriptor"/>
Ii.Q: In custom report XML, often a Descriptor is available as an attribute for a field.
Avoid using a Descriptor, as the value can change. Instead, add a field to your
report that outputs the value directly.
As a last resort, you can use a reference ID value, but ensure that there is
consistency across the reference ID values.
XPATH PREDICATES
XPath predicates define a node based on a condition. To use a predicate, insert the condition
within brackets directly after the node. For example:
This means, "In the Transaction Currency node, find the ID node that has an attribute named
'type' with a value of Currency_lD".
XPATH AXES
You can use XPath axes to refer to a node in relation to the current node of the processor.
Some common axes are child, descendant, parent, ancestor, and self.
To use, state the axis name followed by two colons and then the node name: axis::node.
For example, descendant::wd:position selects all nodes named position that are descendants of
the current node.
Resource: View the w3schools XPath Axes page for more information.
�
SYMBOLS IN XPATH
You can use symbols in XPath instead of specifying a node explicitly. The following table
outlines common symbols you can use.
r@(l
ACTIVITY 3.1 - ADD XPATH EXPRESSIONS TO AN XSLT
� FILE
, Business Case: The WICT EIB Positions integration system's requirements changed. Update
: the XSLT file so that the output includes the positions' locations as well as current employee
: names and IDs.
2. The XSLT file includes three tags that do not contain any elements. Locate each tag
and add the appropriate functions and XPath to output the desired information.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
I@ Activity Complete I
XPATH FUNCTIONS
XPath supports simple functions. For example, this statement retrieves the Hire_Date field and
outputs the substring of the first 10 characters.
cxsl:value-of select="substring(wd:Hire_Date,1,10)"/>
Common XPath functions include concat, string-length, count, format-number, and format-date.
XPATH FUNCTIONS
XPath supports simple functions. For example, this statement retrieves the Hire_Date field and
outputs the substring of the first 10 characters.
<xsl=value-of select="substring(wd=Hire_Date,1,10)"/>
Common XPath functions include concat, string-length, count, format-number, and format-date.
w
�
Glossary: For a complete list of functions, visit the w3schools Function
Reference page.
2. Review the examples of XPath expressions, noting the use of predicates and functions.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
I @ Activity Complete I
XSLT for Workday
Business Case: The XML output for the WICT EIB Positions integration system does not
output any data using the existing positions_match_issue.xsl file. The output displays the XML
tags only, as shown below. Follow the instructions in the XSLT style sheet to fix the XPath
statements.
. <?xml version="l.0" encoding="UTF-8"?>
<positions>
<position>
<position_ID/>
<title/>
<location/>
<employee_ID/>
<name/>
</position>
• </positions>
A. Step 1: Remove the forward slash at the beginning of each XPath statement.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
A. Step 2: Remove the forward slash at the beginning of the for-each XPath.
B. Step 3: Modify the select attribute so that position information is only output for
each filled position.
4. Return to Workday and repeat the prior task to test the new XSL style sheet. View the
output and confirm the data outputs correctly.
A. Why does the leading forward slash in the value-of select XPath statements
prevent the data from outputting?
B. Why does the leading forward slash in the for-each XPath statement have no
effect on the XML output?
I @ Activity Complete I
Task #3
4A. Why does the leading forward slash in the value-of select XPath statements prevent the
data from outputting? The processor is looking for the elements from the root element.
4B. Why does the leading forward slash in the for-each XPath statement have no effect on the
XML output? The template matches on the root and the XPath already includes the
wd:Report Data root node.
OVERVIEW
This chapter explains how XSLT processes instructions and how to use templates in your style
sheets. You will also learn how to output text files in addition to XML.
OBJECTIVES
XSLT TEMPLATES
1. A match attribute that contains XPath to indicate the XML node to match on
2. Instructions for what to do to the node, contained in the body of the template
Each transformation typically contains a template with a match attribute that matches on the
root node. The transformation can include additional templates that match on other nodes. The
XSL style sheet processes the templates in the order that it reads the XML source document.
FOR-EACH VS APPLY-TEMPLATES
To apply the same instructions to a repeating node, you can use xsl:for-each or xsl:template and
xsl:apply-templates.
For example, you could have one template only that matches on the root node. Then, use
xsl:for-each statements to indicate when to apply instructions for a repeating element.
Or, you could create a template that matches on the repeating element, so the template will run
each time the processor reads the element.
The for-each statement and apply-templates accomplishes the same thing, but apply-templates
is consistent with the XSLT processing model. For-each looks similar to loops in typical iterative
programming.
For-each is easier to read for simple collections of elements, but requires nesting. Apply
templates separates out instructions to specific elements and therefore makes the code easier
to reuse if the source document structure changes.
XSLT for Workday
2. One at a time, edit the XSLT attachment for the WICT EIB Positions integration and test
the positions_for_each.xsl and positions_apply_templates.xsl files.
I0 Activity Complete I
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert the positions_for_each_with_locations.xsl file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
2. Locate and copy the nested for-each statement that processes hiring locations.
4. Using the existing templates as a guide, create a new template for locations and call it
using the apply-templates statement.
6. Return to Workday and repeat the prior task to test the new stylesheet. View the output
and confirm the data outputs correctly.
I0 Activity Complete I
VARIABLES
You can create a variable to hold a value to refer to later. Variable values cannot change once
you set them.
Example: You could add a variable called "debug" and set it to true or false. Then,
include conditional logic to execute log steps if it is debug mode, if the debug
variable is set to true.
Example: Create a variable for a line break or delimiter. Or, declare a variable for a
calculation.
<xsl:variable name="lineBreak" select=" '
i
' "/>
<xsl=variable name="delimiter" select=" ',' " />
<xsl:variable name="count" select="count(wd:Report_Data/
wd:Report_Entry)" />
To call the value, use the $ symbol with the variable name:
<xsl:value-of select="$variableName"/>
FILE FORMATTING
You can use XSLT to transform the source document into a different file type. For example, you
can output the data in .csv or .txt file extensions.
To modify the output type, add the xsl:output element with the "method" attribute as a child of
the xsl:stylesheet element. For Workday, the most common method types are XML and text.
CSV FILE
<xsl:value-of select="$linefeed"/>
• Add <xsl:text></xsl:text> where static text should go.
To output a fixed width file, create a custom function that defines the fixed width parameters. In
addition, designate the output method as text and include variables for linefeed and padding.
To avoid creating and managing a custom function in your XSLT, Workday recommends using a
document transformation connector. Workday has two extension libraries available in document
transformation and Workday Studio to assist with transformation needs: Element Transformation
and Validation (ETV) and XML to Text ( X T T). The XT T library has built-in fixed width attributes
that make the transformation much simpler than creating and managing a custom function.
• For text files, include the <xsl:text> element in the template that matches on the root
node and populate it with the series of column headers. For a header, position the
<xsl:text> element first before applying templates or calling any values. For the
footer, insert <xsl:text> last.
• For XML files, create tags to contain the header or footer information, and similarly
include tags in the root node template. Or, create a template to call in the root node
template.
: Business Case: The requirements changed for the WICT EIB Positions integration system.
• Modify the XSLT file so that the integration output is in CSV format instead of XML.
2. The XSLT file includes four comments to indicate where there is missing information.
Locate each comment and add the appropriate functions or text to output the desired
information.
3. Select the integration system's Related Actions and then Enterprise Interface > Edit.
6. Click OK.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
I0 Activity Complete I
OVERVIEW
This chapter outlines different ways to restructure the input data to align with the output file
requirements. You will compare for-each statements vs. apply-templates and identify use cases
for the identity transformation.
OBJECTIVES
To output data, consider if you want to include tags, attributes, child elements, or solely the
element text. The following table summarizes the various methods for extracting data and
provides an example output for the XML snippet below. Note that the example displays the
output of the methods when they are within a template that matches on wd:Country_Reference.
<wd:Country_Reference wd:Descriptor="France">
<wd:ID wd:type="WID">54c5b697lffb4bf0bl16fe765lec789a</wd:ID>
<wd:ID wd:type="ISO_3166-l_Alpha-2_Code">FR</wd:ID>
<wd:ID wd:type="ISO_3166-l_Alpha-3_Code">FRA</wd:ID>
<wd:ID wd:type="ISO_3166-l_Numeric-3_Code">250</wd:ID>
</wd:Country_Reference>
2. Search for intsys: get candidates and select the Get Candidates (EIB) integration
system.
3. View the EIB's data source and delivery details. The EIB does not have a
transformation.
4. Select the integration's Related Actions and then Integration> Launch/ Schedule.
6. When the integration event completes, download the output file, GetCandidates.xml.
7. Open the file in a text editor. The file contains the web service response, without any
modifications.
3. Locate the wd:Country_Reference element in the XML file and view the child elements.
4. Returning to your tenant, run the Create XSLT Attachment Transformation task.
8. Navigate to the Get Candidates (EIB) integration and select its Related Actions and
then Enterprise Interface > Edit.
11. Launch the integration system and view the output file.
I0 Activity Complete I
CREATE AN ATTRIBUTE
<worker>
<xsl=attribute name="ID" select="wd=Employee_ID"/>
</worker>
Alternatively, you can use a shortcut to create an attribute using the following syntax:
<worker ID="{wd:Employee_ID}"/>
2. The XSLT file includes four comments that indicate where to insert a copy-of, copy, or
value-of statement and also add an attribute. Locate each comment and add the
appropriate functions and XPath to output the desired information. Note: view the activity
business case or the candidates_end_result.xml file to view the output you need to
create.
D. Statement #4 - Output the wd:Skill_Name child elements, including tag and text.
4. Click Select Files and upload your updated XSLT file. Click OK.
6. Select the integration system's Related Actions and then Enterprise Interface > Edit.
8. In the Custom Transformation field, select the Candidates EIB XSLT file. Click OK.
9. Select the integration system's Related Actions and then Integration > Launch /
Schedule.
11. Again, accept the default launch parameters and click OK.
12. When the integration completes, select the Output Files tab.
I 0 Activity Complete I
IDENTITY TRANSFORMATION
The identity transformation produces an identical copy of the XML input. Use the identity
transformation when you need to make a few specific changes to the input document. You can
add templates that match on the fields to change, but otherwise, the original data outputs
exactly as is.
Tur The identity transformation is a set of code that you can optionally use if it
helps you write your transformation more easily.
For example, you could write your transformation so that you explicitly specify each
field to output and how to reformat it.
Or, you can use the identity transformation to do the opposite: pull all fields as they
are in the source XML and then specify templates for the fields that you need to
change.
3. Note that the identity transform template already exists in the file as well as four
separate templates. Identify the XPath for each of the templates and add to the template
match="" statement based on the requirements below:
3. Select the Get Candidates XSLT attachment transformation and click OK.
4. Click the trash can icon to delete the existing XSLT file.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
I@ Activity Complete I
OVERVIEW
T his chapter outlines how to apply conditional logic statements, custom functions, and date
formatting.
OBJECTIVES
• Add conditional logic to the XSLT transformation to exclude or target specific records.
• Describe when to use variables, parameters, and custom functions.
You can load data into Workday using an inbound EIB. You can either choose to load the data
using a predefined template in Excel or XML or you can write your own web service request. To
write a web service request, you will need to format the data to match a Workday Web Service
inbound operation, which requires XSLT to transform the input document.
The Supported Inbound EIB Operations report identifies the web service operations that
inbound EIBs support.
Note: A Workday Studio integration system is more efficient and scalable than EIB
if you have large files that require transformation.
WSDL
A web service request must adhere to predefined structure and data validation rules contained
in its Web Service Description Language (WSDL). The WSDL details the elements within the
request as well as the structure and format of the response.
Resource: The Workday Web Services Directory available via Workday Community
provides details for each operation. You can view the WSDL, request and response
requirements, and a description of all elements. For example, view details for
the Maintain Contact Information operation.
The XSLT for an inbound operation needs to select va llues from the input file to produce the web
service request.
XSLT
To import data with an EIB, select the appropriate Retrieval Method in the Get Data section.
Specify the address, directory, authentication details, and file name or file pattern. You can
optionally choose to delete the file after retrieval, or decompress or decrypt the file.
Select the WWS operation delivery method and select the web service operation to use.
CONDITIONAL LOGIC
To specify instructions based on various conditions, you can use the choose or if element. Nest
them within a for-each statement to handle multiple records.
Use the choose element when there are multiple separate conditions and you only want one
outcome to execute. If there are multiple conditions that evaluate to true, only the first one will
execute. Follow the syntax below.
<xsl:choose>
<xsl:when test="">
</xsl:when>
<xsl:when test="">
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
To use the if element, follow the syntax below. Note every test condition that evaluates to true
will execute, regardless if a previous condition executed.
<xsl:if test="">
</xsl:if>
Business Case: Create an inbound EIB to load employee email addresses from an
external source. There is an existing XSLT to use as a start, but it assumes that the source file
indicates if the email address is a home or work email. Instead, it indicates if it is a company
or personal email. Use choose-when logic to update the XSLT to map the email types to the
types Workday expects.
2. View the XSLT file. The style sheet transforms the source file into a web service request
for the Maintain Contact Information for Person Event Request operation.
3. Locate the bsvc:Usage_Data section and note the communication usage type is
"WORK".
4. View the XML file. What are the two different email types used?
5. Update the XSLT file so that the communication usage type is "WORK" if the input file's
email type is "Company", and "HOME" if the email type is "Personal".
4. Click the Select Files button and add the updated XSLT file.
1. Search for Create E/8 and select Create EIB from the Tasks results.
2. Select Inbound.
4. Click OK.
5. Click Next to access the Get Data page and edit the Data Format section.
14. From the Workday Web Service Operation prompt, select Maintain Contact
Information (Web Service).
1. From the EIB's Related Actions, select Integration > Launch I Schedule.
3. In the Integration Criteria table, in the Integration Attachment row, click the Value column
prompt and select Create Integration Attachment.
5. Click OK.
7. In the Integration Details tab, scroll to check the number of records successfully
processed.
10. When the zip file finishes downloading, open the rootpart.xml file to view the
transformed output, which is the web service request. Note how there are either WORK
or HOME values for the bsvc:type="Communication_Usage_Type_lD" value.
Hint: Enter the employee number directly in the search box to quickly locate the
employee's. page.
8 Email Address
��.wotMav.iw
I @ Activity Complete I
XSLT for Workday 63
Confidential © 2021 Workday, Inc.
XSLT for Workday
PARAMETERS
You can define a value for both the parameter and variable elements. Parameters differ from
variables in that you can pass a parameter value into a function, iteration, or template and it can
have a different value for each iteration. To call the value, use the$ symbol with the parameter
name.
CALL A T EMPLATE
You can create a template and call it from another template. First, create a template with an
input parameter. Then, use the xsl:call-template element within another template. The
instructions process using the parameters you provide.
<xsl=template name="formatNumber">
<xsl:param name="number"/>
<xsl:value-of select="format-number($number, ' #.00' "/>
</xsl:template>
Within another template, use the xsl:call-template element to call the template.
<xsl:call-template narne="forrnatNumber">
<xsl:with-param name="number" select="wd:hours_worked"/>
</xsl:call-template>
CUSTOM FUNCTIONS
You can create your own function to call within XPath in your XSL file. Custom functions are
useful when you need to apply the same formatting or instructions in multiple places in the
XSLT. llf you create a function, you can refer to the function name instead of writing the full
instructions each time.
To create a function, first declare a new namespace in the xsl:stylesheet element so that you
can distinguish your function from xsl elements. For example, use:
xrnlns:this="urn:this-stylesheet"
Then, declare the function name and use the param element to define inputs. Use the
namespace prefix with the function name.
<xsl:function narne="this:functionName">
<xsl=param name=""/>
</xsl:function>
To use the function, insert the namespace prefix with the function name into a value-of
statement in your XPath, for example:
<xsl:value-of select="this:functionName(wd=Availability_Date)"/>
DATE FORMATTING
To format date fields, you can use a template or a custom function with an input parameter. Date
fields from Workday often contain a timestamp, so you can use the template or function to
remove the time component.
Business Case: The WICT Positions EIB output file must include the position availability date,
: in the format of MM/ 00/YYYY. Use a template with a parameter to format the date field.
2. The style sheet includes a template named stripTimeFromDate. Follow the steps below
to use the template:
A. Step #1: Locate the stripTimeFromDate template and enter the parameter name,
subjectDate, for both the parameter declaration and the value-of select
statement.
C. Step #3: Use the xsl:with-param function to indicate the input variable,
subjectDate.
3. Once you make the changes, save the updated file. Optionally compare your file with the
positions_date_answer.xsl file.
3. Select the integration system's Related Actions and then Enterprise Interface > Edit.
6. Click OK.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration > Launch /
Schedule.
10. When the integration completes, select the Output Files tab.
I 0 Activity Complete j
r@Jl
ACTIVITY 6.3 - FORMAT DATE FIELDS WITH A
� FUNCTION
I Business Case: The WICT Positions EIB output file must include the position availability date,
: in the format of MM/DD/YYYY. Use a function with a parameter to format the date field.
2. The style sheet includes a function named this:formatDate. Complete the following steps
to use the function for Availability Date.
A. Step #1: Locate the function this:formatDate and enter the name Input for the
parameter name and the value-of select statement.
B. Step #2: Update the wd:Avail_Date output to use the function so that the field
outputs with MM/DD/YYYY format.
3. Once you complete the changes, save the updated file. Optionally compare your file with
the positions_date_function_answer.xsl file.
3. Select the WICT Positions EIB XSLT attachment transformation and click OK.
5. Click Select Files and insert your updated XSLT file. Click OK.
7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.
10. When the integration completes, select the Output Files tab.
I0 Activity Complete I
OVERVIEW
This chapter introduces the main benefits of XSLT 3.0 and how to use the streaming method.
OBJECTIVES
XSLT 3.0
There are three versions of XSLT. You can use XSLT 2.0 or 3.0 for Workday integrations.
However, only the Workday Studio integration tool currently supports XSLT 3.0 transformations.
A major benefit of XSLT 3.0 is streaming. Streaming transforms an XML document sequentially
as it reads the document instead of loading the whole XML tree into memory. Streaming is more
memory efficient and you can therefore use it to process much larger documents per
transformation.
When using streaming, the processor brings one element at a time into its memory space and
does not load in descendants as it is reading the document.
Therefore:
Note that you can get around the above limitations by using burst mode and other advanced
features.
XSLT 3.0 uses an element called mode. Use the mode element to specify:
1. If the mode should use streaming (in the streaming attribute). Values include yes or no.
2. What to do if a node does not match a template rule (in the on-no-match attribute).
Values include shallow-skip, shallow-copy, deep-skip, and deep-copy.
You can apply the mode to the entire document, or you can apply a streaming mode to specific
templates or sections of your transformation.
ON-NO-MATCH ATTRIBUTE
T he mode on-no-match attribute indicates what to do if a node does not match a template rule.
To use XSLT 3.0 with streaming, apply the following charnges to an XSLT 2.0 transformation:
To apply the identity transformation in an XSLT 3.0 style sheet, use the statement <xs 1: mode
on-no-match="shallow-copy"/>.
2. The style sheet applies a streaming transformation to the positions_report.xml file. Note
the following components:
B. The mode element includes an attribute that enables streaming and another that
defines the on-no-match behavior to be a shallow-skip.
C. There is a separate template for each nested level and child element that needs
to output.
2. Run the Edit Integration Service Attachment task (not the Edit Integration Attachment
Service task - you are editing the attachment, not the service itself).
4. Click the trash can icon to remove the existing file and upload the
positions_streaming.xsl file.
5. The source XML file needs to be updated as well to use the latest report XML. Again,
run the Edit Integration Service Attachment task.
7. Click the trash can icon to remove the existing file and upload the
positions_report.xml file. (Note that the file name does not change; the file that exists
in the integration service contains an old XML structure.)
I0 Activity Complete I
BURST MODE
Burst mode enables you to reference descendant elements that you cannot access in
full streaming. To use burst mode, use the copy-of element to designate the section of the XML
tree to reference. T here are multiple ways to apply burst mode.
In one method, assign the data to a variable to reference within XPath statements as shown
below.
<xsl:template match="/wd:Report_Data/wd:Report_Entry">
<xsl:variable name="ReportEntry" select="copy-of()"/>
</xsl:template>
Alternatively, for a second method, use the copy-of element directly in a for-each statement as
follows.
<xsl:template match="wd:Report_Data">
<xsl:for-each select="wd:Report_Entry/copy-of( )">
</xsl:for-each>
</xsl:template>
Or, for a third method, set a mode that does not use streaming and apply it to the
template. Declare the mode in the beginning of the stylesheet and then use it with either the
apply-templates or template elements.
</xsl:template>
Or:
</xsl:template>
Business Case: There are new requirements for the positions output file and the fields need to
output in a different order than how they appear in the source XML. Now for filled positions,
the employee ID and employee name should output above the position data.
Update the streaming XSL style sheet to use burst mode so you can reference descendant
: elements of the Report Entry node in a specific order.
2. Modify the XSLT file so that it applies burst mode to the positions_report.xml file using
the variable method. Set the burst mode at the /wd:Report_Data/wd:Report_Entry
element level.
B. Step 2: Add an xsl:mode element that sets streamable to yes and on-no-match to
shallow-skip.
2. Run the Edit Integration Service Attachment task (not the Edit Integration Attachment
Service task - you are editing the attachment, not the service itself).
3. Select the positions_start.xsl integration service attachment (or the most recent file
name if you already edited the attachment) and click OK.
4. Click the trash can icon to remove the existing file. Then upload the new file.
1. Return to your XSL file and save a new version of the file for burst mode without a
variable.
2. Modify your existing burst mode XSLT to use burst mode without a variable.
B. Add a for-each statement within the template with the following syntax:
C. Update the XPath for the value-of select statements to account for the new
template match XPath and the for-each.
3. Once you finish, save your changes to the new file version. You can compare your saved
file with the positions_streaming_burst_copy-of.xsl file.
4. Repeat the prior task to test the transformation in the Workday Studio XSLT Streaming
Attachment integration in Workday. Note that the output shows empty nodes for
employee_id and name, because the employee_id and name nodes output whether or
not the XSLT processes a value. You could suppress the elements by including a
template or for-each on the $ReportEntry/wd:Worker_Detail/wd:Worker path.
I0 Activity Complete I
ITERATE FEATURE
The iterate function is similar to a for-each statement except that it can pass on data from one
iteration to the next and perform instructions upon completion. Also, it processes records in
source order. It is helpful for calculations spanning multiple elements, like sums or averages.
Note: Only use the iterate feature if you need to pass values from one iteration to
the next.
ACCUMULATOR FEATURE
Use accumulators to store values to refer to later as you stream forward through the XML. The
accumulator function can also perform calculations while the processor reads the file
sequentially. Specify when to trigger the accumulator via an XPath expression and define the
action to perform.
Ii.Q: The accumulator feature is an alternative to the iterate feature for calculations
spanning multiple elements and templates.
Element Description
Name The accumulator name, to refer to later in the code using $Name, where Name is
the accumulator's name
As The data type, such as xs:decimal, xsl:string, or xs:integer
Initial Value The starting value, such as O or'' (depending on the data type)
B. Count of the number of filled positions {the positions that have pay listed)
4. Add a summary to the end of the file that reports the following:
A. Sum
B. Count
C. Average
2. Run the Edit Integration Service Attachment task (not the Edit Integration Attachment
Service task - you are editing the attachment, not the service itself).
3. Select the positions-start.xsl integration service attachment (or the most recent file
name if you already edited the attachment) and click OK.
4. Click the trash can icon to remove the existing file. Then u
I @ Activity Complete I
XSLT for Workday
This course is included in one or more Workday Pro tracks. Workday Pro is an accreditation
program designed for those who have, or want to achieve, Workday expertise like that of a
Workday-certified consultant. It consists of several tracks spanning a variety of product areas,
each with relevant courses, plus an online test.
Want to know more? Visit the following Workday Community pages, or work with your Training
Coordinator to submit a case in the Workday Customer Center.
• •
Report Calculated Workday Integration XSLTfor Introduction to Advanced
Writer F ields System Fundamentals Workday Workday Studio Workday Studio
APPENDIX 8 - RESOURCES
NOTEPAD++
I
3. Locate the XML Tools plugin and select the checkbox, if not selected already. T hen click
the Install button.
4. The program will prompt you to accept the installation steps, and will close the program
and then restart after it completes the installation.
8. A box prompts you to select either an XML or XSLT file. View the files, or tabs, that are
open in the program. If the XML file tab is selected, then load the XSLT file in the
prompt. If the XSLT file tab is selected, load the XML file in the prompt.
9. Click Transform. A new file opens with the resulting output from the transformation.
Incorrect namespace Include the new namespace in the tags and declare in
the beginning of the style sheet.
Namespace appears in every element. Declare the namespace in the root node.
Special characters appear that should Fix in Workday rather than the style sheet.
not.
Special characters do not appear that Escape the special characters and make sure there
should (especially in a delimited file). are no delimiters naturally appearing in the text.
Cannot get data to output. Modify the XPath statement.