0% found this document useful (0 votes)
207 views84 pages

XSLT

Uploaded by

gajjalavivek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views84 pages

XSLT

Uploaded by

gajjalavivek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

workday


EDUCATION

XSLT for Workday


Course Manual and Activity Guide
This booklet is protected by copyright and is solely for the educational purposes of individuals who have enrolled in this specific
Workday training course. Any further sale, alteration, reproduction, or distribution of any part of this material to any other person is
strictly prohibited. Where provided to you in electronic format, you may only print from it as necessary for your own private study and
research. Failure to comply with the terms of this warning may expose you to legal action for copyright infringement and disciplinary
action by Workday, Inc.

© 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.

XSLT for Workday

Training the way you want it, within your budget.


We offer a variety of learning delivery options,
(9 � ��.L,.
ranging from accreditation to self-paced
1-1;L � � independent learning offerings.
ll

Workday Pro

A customer accreditation program designed for those who have, or want to


achieve, Workday expertise like that of a Workday-certified consultant.

Workday Touchpoints Kit

� A collection of diagrams, heatmaps, and organizational details used to convey how


a decision in one product area can impact functionality or configuration in another.

Adoption Kit

A collection of job aids, videos, and communication templates designed to


accelerate Workday adoption of employee and manager self-service tasks.

The Next Level

A series of online demonstrations that show Workday in action and provide tips on
deploying features.

Enablement Workshops

In-person training with hands-on configuration in your own sandbox tenant.

Learn In-Person

In-person training combining lectures, social learning, product demonstrations, and


hands-on activities teaching you how to configure Workday in a training tenant.

XSLT for Workday


Confidential© 2021 Workday, Inc.
1:1 Bookshelf About Support - □ X
___ __________

My Library XSLT for Workday X

:::: 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.

Learn more about available training opportunities on Workday Community:


.. https://community.workday.com/training ..

< □ /81 > I"' ,


I. .,
XSLT for Workday

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.

EBOOK FEATURES & NAVIGATION

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:

Return to the Bookshelf view.

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.

ii Notebook View and search your notes and highlighted text.

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.

XSLT for Workday 3


Confidential© 2021 Workday, Inc.
XSLT for Workday

CONTENTS

XSLT for Workday........................................................................................................................ 9

Description................................................................................................................................ 9

Objectives ................................................................................................................................. 9

Agenda......................................................................................................................................9

Chapter 1 -Explore Workday XML ........................................................................................... 11

Overview................................................................................................................................. 11

Objectives................................................................................................................................11

What is XML?.......................................................................................................................... 11

XML Structure ...................................................................................................................... 11

XML in Workday................................................................................................................... 11

RaaS Configuration............................................................................................................. 13

Activity 1.1 - Create Positions EIB with a Custom Report ................................................... 14

Simple Types vs Instance Types............................................................................................. 16

RaaS XML Recommendations................................................................................................ 16

Activity 1.2 - View Custom Report XML ............................................................................... 17

Chapter 2 -Transform Workday XML with XSLT.................................................................... 19

Overview ................................................................................................................................. 19

Objectives............................................................................................................................... 19

What is XSLT?........................................................................................................................ 19

XSLT in Workday................................................................................................................. 19

XSLT Structure........................................................................................................................20

4 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

XSLT Root Element............................................................................................................. 20

XSLT Namespace................................................................................................................ 20

XSLT Templates...................................................................................................................21

How Does XSLT Work? .......................................................................................................... 22

EIB with XSLT......................................................................................................................... 22

Create XSLT Attachment..................................................................................................... 22

Configure Transform............................................................................................................ 22

Edit XSLT Attachment Transformation.................................................................................22

Runtime Boundaries on EIBs with Custom XSLT Transformations ..................................... 22

Activity 2.1 - View an XSLT File........................................................................................... 24

Chapter 3 - Write XPath Expressions...................................................................................... 27

Overview................................................................................................................................. 27

Objectives............................................................................................................................... 27

What is XPath? ....................................................................................................................... 27

XPath Usages......................................................................................................................... 27

XPath Expressions.................................................................................................................. 28

XPath Attributes...................................................................................................................... 28

XPath Predicates.................................................................................................................... 28

XPath Axes............................................................................................................................. 29

Symbols in XPath....................................................................................................................29

Activity 3.1 - Add XPath Expressions to an XSLT File......................................................... 30

Xpath Functions...................................................................................................................... 32

XSLT for Workday 5


Confidential© 2021 Workday, Inc.
XSLT for Workday

XSLT 3.0................................................................................................................................. 70

How Streaming Works......................................................................................................... 70

XSLT Streaming Modes....................................................................................................... 70

On-no-match Attribute......................................................................................................... 71

How to Use Streaming......................................................................................................... 71

Streaming Identity Transformation ....................................................................................... 71

Activity 7.1 - Modify Positions Transformation to Use Streaming (Optional)....................... 72

Burst Mode..............................................................................................................................74

Activity 7.2 - Use Burst Mode.............................................................................................. 75

Iterate Feature........................................................................................................................ 77

Accumulator Feature...............................................................................................................77

Activity 7.3 - Calculate a Sum and Average with Accumulators.......................................... 78

Appendix A - Workday Pro....................................................................................................... 80

Workday Pro Studio................................................................................................................ 80

Appendix B - Resources........................................................................................................... 81

Notepad ++............................................................................................................................. 81

Common XSLT Issues............................................................................................................ 81

8 XSLT for Workday


Confidential © 2021 Workday, Inc.
XSLT for Workday

XSLT FOR WORKDAY

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

By the end of this course, you will be able to:

• Use XPath to access XML elements and attributes.


• Explain how to use XSLT templates.
• Use common XSLT elements to transform XML.
• Compare methods to extract elements and attributes.
• Describe when to use variables, parameters, and custom functions.
• Modify an XSLT file to use version 3.0 with streaming.

AGENDA

Day 1:

• Chapter 1 - Explore Workday XML


• Chapter 2 - Transform Workday XML with XSLT
• Chapter 3 - Write XPath Expressions
• Chapter 4 - Apply Templates and File Format

Day 2:

• Chapter 5 - Restructure XML Nesting

XSLT for Workday 9


Confidential © 2021 Workday, Inc.
XSLT for Workday

• Chapter 6 - Add Conditional Logic and Custom Functions


• Chapter 7 - Improve Performance with XSLT 3.0

10 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

CHAPTER 1 - EXPLORE WORKDAY XML

OVERVIEW

This chapter distinguishes Extensible Markup Language (XML) in Workday and provides
recommendations for configuring a Report-as-a-Service.

OBJECTIVES

By the end of this chapter, you will be able to:

• Obtain Workday XML from a RaaS.


• Configure a report to use with an XSL transformation.

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

XSLT for Workday 11


Confidential© 2021 Workday, Inc.
XSLT for Workday

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:

<?xml version='l.0' encoding='UTF-8'?>


<wd:Report_Data xmlns:wd="urn:com.workday.report/
WDINST_RW_EIB_Positions">
<wd:Report_Entry>
<wd:Position>P-00002</wd:Position>
<wd:Title>Chief Information Officer - Oliver Reynolds-P-00002</
wd:Title>
<wd:AvailabilityDt>2000-01-01-Q8:00</wd:AvailabilityDt>
<wd:worker wd:Descriptor="Oliver Reynolds">
<wd:ID wd:type="WID">3895af7993ff4c509cbea2el817172e0</wd:ID>
<wd:ID wd:type="Employee_ID">21003</wd:ID>
</wd:Worker>
<wd:Location wd:Descriptor="San Francisco">
<wd:ID wd:type="WID">dl3a7c46a06443c4a33c09afbdf72c73</wd:ID>
<wd:ID wd:type="Location_ID">San_Francisco_site</wd:ID>
</wd:Location>
</wd:Report_Entry>
</wd:Report_Data>

Simple XML

Unlike Workday XML, Simple XML:

• Does not contain integration IDs.


• Simplifies single- and multi-instance fields to string-type elements.
• Outputs dates without times or GMT offsets.

For example:

<?xml version='l.0' encoding='UTF-8'?>


<wd:Report_Data xmlns:wd="urn:com.workday.report/
WDINST_RW_EIB_Positions">
<wd:Report_Entry>
<wd:Position>P-00001</wd:Position>
<wd:Title>Chief Executive Officer - Steve Morgan-P-00001</
wd:Title>
<wd:AvailabilityDt>2000-01-01</wd:AvailabilityDt>
<wd:worker>Steve Morgan</wd:worker>
<wd=Location>San Francisco</wd=Location>

12 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

</wd:Report_Entry>
</wd=Report_Data>

RAAS CONFIGURATION

Configure two features of a RaaS report to apply a custom transformation using


XSLT: namespace and column heading override XML alias. If the report has a related business
object, you must also configure the group column heading override XML alias.
XSLT for Workday

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.

Task #1: Create an EIB

1. Sign in as Logan McNeil (/mcneil).

2. Search for and select the Create EIB task.

3. In the Name field, enter WICT E/8 Positions.

4. Select the Outbound option.

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.

10. In the File Name field, enter positions.xml.

11. Click Next.

12. Review the information, then click OK.

Task #2: Launch an EIB

1. Locate the WICT EIB Positions integration system.

2. Launch the EIB to run now and enter the following values for the report prompts:
Field Name Entry Value

Starting Availability Date 01/01/2020


Ending Availability Date Today's Date

3. Click OK.

14 XSLT for Workday


Confidential © 2021 Workday, Inc.
XSLT for Workday

SIMPLE TYPES VS INSTANCE TYPES

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.

Field Type UI XML


Text, numeric, date, Black text Text only
etc.
Instance Blue text with Related Text with attributes and a child node for
Actions to drill into further each ID type, e.g. WID and Reference ID

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.

<wd:Location wd:Descriptor="San Francisco">


<wd:ID wd:type="WID">dl3a7c46a06443c4a33c09afbdf72c73</wd:ID>
<wd:ID wd:type="Location_ID">San_Francisco_site</wd:ID>
</wd:Location>

RMS XML RECOMMENDATIONS

When creating a custom report, Workday recommends that you:

• 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).

16 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

ACTIVITY 1.2 - VIEW CUSTOM REPORT XML

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.

Task #1: Modify Report Configuration

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

Availability Dale AvaU_Date

Hiring Restrictions - Location Hiring_Location

Hiring Restrictions - Position Worker Type Hiring_Type

3. Select the Prompts tab.

4. Modify the Availability Date Starting Prompt so that it is equal to 01/01/2020

Task #2: View Workday XML

1. Return lo the WDINST RW EIB Positions with RBOs custom repor t

2. Select the report's Related Actions and then Web Service> View URLs.

3. Leave the default prompt values and click OK.

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.

5. Right-click on the page with XML and select Save As.

6. Save the XML file as positions_repor1.xml.

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.

XSLT for Workday 17


ConfidentlOI O 2021 WOO<�Ay, toe
XSLT for Workday

ACTIVITY 1.2 - VIEW CUSTOM REPORT XML


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.

Task #1: Modify Report Configuration

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

Availability Date Avail Date

Hiring Restrictions - Location Hiring_Location

Hiring Restrictions - Position Worker Type Hiring_Type

3. Select the Prompts tab.

4. Modify the Availability Date Starting Prompt so that it is equal to 01/01/2020

Task #2: View Workday XML

1. Return to the WDINST RW EIB Positions with RBOs custom report.

2. Select the report's Related Actions and then Web Service > View URLs.

3. Leave the default prompt values and click OK.

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.

5. Right-click on the page with XML and select Save As.

6. Save the XML file as positions_report.xml.

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.

XSLT for Workday 17


Confidential© 2021 Workday, Inc.
XSLT for Workday

A. Why do some Report Entry nodes include the Worker_Detail section, while other
Report Entry nodes do not?

B. What three pieces of information does the Worker_Detail node output?

C. Which fields output their associated IDs?

D. Where does the Restrictions_Location node display the name of the location?

E. What is the date format of the Availability_Date field?

ACTIVITY ANSWERS

View Workday XML

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

18 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

CHAPTER 2 - TRANSFORM WORKDAY XML WITH XSLT

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

By the end of this chapter, you will be able to:

• Describe the main components of an XSLT file.


• Create and test an XSLT attachment in Workday.

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:

• Rename XML nodes.


• Create new XML elements.
• Add XML attributes.
• Group data values into a single element.
• Filter out data values based on a condition.
• Apply unique date or string formatting.

,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.

XSLT for Workday 19


Confidential © 2021 Workday, Inc.
XSLT for Workday

Integration Tool XSLT Use Case


Outbound EIB Transform custom report output or a web service response.
Inbound EIB Transform an external file to a web service request.
Connector Transform connector output using a document transformation.
Workday Studio Transform any XML, including a custom report, web service response, or
output from another 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.

XSLT ROOT ELEMENT

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

Integration Tool XSLT Use Case

Outbound EIB Transform custom report output or a web service response.


Inbound EIB Transform an external file to a web service request.
Connector Transform connector output using a document transformation.
Workday Studio Transform any XML, including a custom report, web service response, or
output from another 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 XSLT files must contain a root element, namespace, and at least one template.

XSLT ROOT ELEMENT

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:

• The XSL namespace, xmlns: xsl= "http://www. w3. org/1999/XSL/Transform"


• The source document namespace, either xmlns: wd= "urn: com. workday/ [ report
name with underscores J " for custom reports
or xmlns : wd= urn: com. workday/bsvc for Workday web services
11 II

20 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

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.

Exclude Namespace in Output

Ensure that unused namespaces are not output on the root element of your XML file.

,l<l:l.l versio�='l.0' encodl.no=•trrr-8 1 ?>


File Ullns:�si •http://�·..rw.w3.org/200l/}Y.:.Sche1ta-1nstance"I
- ��- s •urn:co�.workdav/.orkersvnc•>
..Header
Version 34.0 '�ersion
◄ fullFile true FUllF1le
WorkerCount. 198 Wor�erCount
/Reader
<Record
u:ployeeIJ. 21193 �:oyee!J;
""firstNa::ie Jarryl" Firstname
Lastllame Parker< Lastlfam€
�aritalStaeus l!Arried USA t�aritalStaeus
EJ:ailAddress -<lparl.:er@.od:day.net< E.Jtail.Address •
M1reOate 01/01/2000 HireDate>
OriginalBire:>ate 01/01/2000 ,OriginalBireDate
<PositionTitle�Vice President, Consulting Services Pos1tionTitle
<.BasePay 171.073,00</BasePay
/Record
Example of results without the exclude-result-prefixes statement included.

To prevent unused namespaces from appearing, include one of the following statements in the
<xsl:stylesheet> declaration.

• Include exclude-result-prefixes=" [prefix]" to suppress a


specific namespace, such as exclude-result-prefixes="wd".
• Include exclude-result-prefixes=" #all" to suppress all unused namespaces.

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."

Without templates, a style sheet does nothing and outputs nothing.

XSLT for Workday 21


Confidential© 2021 Workday, Inc.
XSLT for Workday

HOW DOES XSLT WORK?

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."

EIB WITH XSLT

CREATE XSLT ATTACHMENT

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.

EDIT XSLT AT TACHMENT TRANSFORMATION

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.

RUNTIME BOUNDARIES ON EIBS WITH CUSTOM XSLT TRANSFORMATIONS

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.

22 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday 23
Confidential© 2021 Workday, Inc.
XSLT for Workday

Important: If your EIB does not perform as expected:


• Filter the data source to reduce its size with custom report filters or web
service launch parameters.
• Review your custom XSLT for possible processing inefficiencies.
• Consider converting your EIB to a Workday Studio integration if the volume
of data is likely to grow over time.

Resource: For more information, view the Manage Outbound EIBs with Custom
XSLTs page on Workday Community.

XSLT for Workday 23


Confidential© 2021 Workday, Inc.
lliE
XSLT for Workday

ACTIVITY 2.1 -VIEW AN XSLT FILE


. . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . .. . . . . . . . . . . . . . . . . . . . .
. . . . . . .. . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . ' ' . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

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>

Task #1: View and Fix XSLT File

1. Open the positions_issues.xsl file.

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").

C. Issue #3: The closing tag for <positions> is missing.

3. Save your changes. (Note: View the positions_issues_answer.xsl file for the answers.)

Task #2: Test Integration System

1. Sign in as Logan McNeil (/mcnei/).

2. Run the Create XSLT Attachment Transformation task.

3. In the Name field, enter WICT Positions E/8 XSLT.

4. Click Select Files and upload your updated XSLT file. Click OK.

5. Navigate to the WICT EIB Positions integration system.

6. Select the integration system's Related Actions and then Enterprise Interface > Edit.

24 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

7. In the left pane, select Transform.

8. In the Transformation Type field, select Custom Transformation.

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.

12. Accept the default parameters and click OK.

13. Specify the report parameters below:


Field Name Entry Value

Starting Availability Date 01/01/2020

Ending Availability Date Today's Date

14. Click OK.

15. When the integration completes, select the Output Files tab.

16. Download the positions.xml file and view the results.

Task #3: (Optional) Edit Attachment Transformation

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.

2. Select the WICT Positions EIB XSLT XSLT Attachment Transformation.

3. Click OK.

4. Click the trash icon to delete the existing file.

5. Click Select files and select the new file to upload.

6. Confirm the new file was successfully uploaded.

7. Click OK.

XSLT for Workday 25


Confidential© 2021 Workday, Inc.
XSLT for Workday

I @ Activity Complete I
XSLT for Workday

I 0 Activity Complete I

26 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

CHAPTER 3 - WRITE XPATH EXPRESSIONS

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

By the end of this chapter, you will be able to:

• Use XPath to access XML elements and attributes.


• Explain when to use relative and absolute XPath expressions.

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">

Use XPath in the select attribute for elements. For example:

<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"/>

XSLT for Workday 27


Confidential © 2021 Workday, Inc.
XSLT for Workday

XPATH EXPRESSIONS

XPath expressions contain either an absolute or relative path.

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:

"wd:Transaction_Currency/wd:ro[@wd:type = 'Currency_ID' )"

This means, "In the Transaction Currency node, find the ID node that has an attribute named
'type' with a value of Currency_lD".

28 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

Resource: For more information on predicates and selecting nodes, view


w3schools XPath Syntax.

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.

Symbol Use to ... Example


Asterisk Select everything within the current <xsl :value-of select="*"/>
element, including children.
Single period Select the current element. <xsl:value-of select=".fwd: ID"/>
Double period Select the current element's parent. <xsl :value-of select="../
wd:Position"/>

XSLT for Workday 29


Confidential© 2021 Workday, Inc.
XSLT for Workday

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.

Task #1: Add Missing Functions and XPath

1. Open the positions_start.xsl file.

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.

A. Location: output the city name.

B. Employee ID: output the employee's ID.

C. Name: output the employee's full name.

3. Save the updated file.

Task #2: Test Integration System

1. Sign in as Logan McNeil (/mcneil).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.

30 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

Field Name Entry Value

Starting Availability Date 01/01/2020


Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

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.

Glossary: For a complete list of functions, visit the w3schools Function


@:7
� Reference page.
XSLT for Workday

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.

32 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

� ACTI V ITY 3.2 - EVALUATE XPATH EXPRESSIONS


� (OPTIONAL)
; Business Case: You may need to write new XPath expressions or modify existing ones as
I requirements change. Use the example expressions provided to write XPath expressions
j that summarize position data.

Task #1: Write XPath Expressions

1. Open the positions_xpath.xsl file.

2. Review the examples of XPath expressions, noting the use of predicates and functions.

Task #2: Test Integration System

1. Sign in as Logan McNeil (lmcneil).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.


Field Name Entry Value

Starting Availability Date 01/01/2020

Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

XSLT for Workday 33


Confidential© 2021 Workday, Inc.
XSLT for Workday

I @ Activity Complete I
XSLT for Workday

0-I ACTIVITY 3.3 - RESOLVE MATCHING ISSUES


. . . . . . . . . ... . .... . . . . . . . . . . . . .. .. .. . . . .. . · · ·· · • · · · . . . . . . . . . . . . ···· ···· · • ·· • ···"·········· -· · · · · · · · -···-· ·· · ·

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>

Task #1 : Remove Leading Forward Slash for Value-of Select

1. Open the positions_match.xsl file.

2. The transformation includes three comments to modify the transformation. Complete


only step 1. You will complete step 2 and 3 later in the activity.

A. Step 1: Remove the forward slash at the beginning of each XPath statement.

3. Save the updated file.

Task #2: Test Integration System

1. Sign in as Logan McNeil (/mcnei/).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

XSLT for Workday 35


Confidential © 2021 Workday, Inc.
XSLT for Workday

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.


Field Name Entry Value

Starting Availability Date 01/01/2020

Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

Task #3: Remove Leading Forward Slash in the For-each XPath

1. Return to your XSLT file.

2. Locate and complete steps 2 and 3.

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.

3. Save the updated file.

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?

36 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

I @ Activity Complete I

XSLT for Workday 37


Confidential© 2021 Workday, Inc.
XSLT for Workday

ACTIVITY ANSWER - RESOLVE MATCHING ISSUES

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.

38 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

CHAPTER 4 -APPLY TEMPLATES AND FILE FORMAT

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

By the end of this chapter, you will be able to:

• Explain how an XSLT file evaluates templates.


• Add headers and footers to an output file.
• Create a fixed length or delimited output file using XSLT.

XSLT TEMPLATES

An XSLT template has two parts:

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.

XSLT for Workday 39


Confidential © 2021 Workday, Inc.
XSLT for Workday

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

� ACTIVITY 4.1 - COMPARE FOR-EACH AND APPLY-


� TEMPLATES (OPTIONAL)
: Business Case: There are two different XSLT files for the WICT EIB Positions integration
! system. One uses for-each logic and one uses apply-templates. Compare both files and
: evaluate the differences.

Task #1: Compare XSLT Output

1. Open both the positions_for_each.xsl and positions_apply_templates.xsl files and


review the structure of the XSLT.

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.

3. Compare the output results.

I0 Activity Complete I

XSLT for Workday 41


Confidential © 2021 Workday, Inc.
XSLT for Workday

�I ACTIVITY 4.2 -APPLY TEMPLATES IN AN XSLT FILE


: Business Case: Hiring Restrictions - Location is a multi-instance field, which can lead to
I confusion when it is transformed into a single output element. Convert a style sheet that uses
: a nested for-each statement for hiring locations to use a separate template instead.

Task #1: Edit XSLT with Nested For-Each

1. Sign in as Logan McNeil (/mcneil).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert the positions_for_each_with_locations.xsl file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameter of Run Now and click OK.

9. Select the following report parameters and click OK


Field Name Entry Value

Starting Availability Date 01/01/2000


Ending Availability Date Today's date

Important: Run the integration with a Starting Availability Date of



01/01/2000 to see positions with multiple hiring locations.

10. When the integration completes, select the Output Files tab.

11. Download the positions.xml file and view the results.

Task #2: Create Apply-Templates XSLT File

1. Open the positions_for_each_with_locations.xsl file.

42 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

2. Locate and copy the nested for-each statement that processes hiring locations.

3. Open the positions_apply_templates.xsl file.

4. Using the existing templates as a guide, create a new template for locations and call it
using the apply-templates statement.

5. Save the updated file. (Note that a solution is provided in


positions_apply _templates_with_location.xsl.)

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

XSLT for Workday 43


Confidential © 2021 Workday, Inc.
XSLT for Workday

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.

The syntax to create a variable is:

<xsl=variable name="variableName" select="text or XPath"/>

Example: Create a variable for a line break or delimiter. Or, declare a variable for a
calculation.
<xsl:variable name="lineBreak" select=" '&#xDi&#xA;' "/>
<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

To output a CSV file, include the following elements:

• Add <xsl:output method="text"/> as a child to the xsl:stylesheet element


• Declare variables for any repeated text, such as linefeeds and separators, and refer to
the variable where needed:

44 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

<xsl:variable name="linefeed" select="'&#xdi&:!fxa;' "></


xsl:variable>

<xsl:value-of select="$linefeed"/>
• Add <xsl:text></xsl:text> where static text should go.

FIXED WIDTH FILE

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.

HEADERS AND FOOTERS

You can add a header or footer to your output document.

• 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.

XSLT for Workday 45


Confidential© 2021 Workday, Inc.
XSLT for Workday

ACTIVITY 4.3 - CREATE CSV FILE


: 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.

Task #1: Modify XSLT to Output CSV File

1. Open the positions_csv.xsl file.

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.

A. Missing item #1: output method type

B. Missing item #2: separator value

C. Missing item #3: column titles

D. Missing item #4: separator in between each field

3. Once you complete the changes, save the updated file.

Task #2: Update Output File Type to Text

1. Sign in as Logan McNeil (lmcnei/).

2. Navigate to the WICT EIB Positions integration system.

3. Select the integration system's Related Actions and then Enterprise Interface > Edit.

4. Navigate to the Deliver section.

5. In the File Name field, replace xm/ with txt so it is positions.txt.

6. Click OK.

Task #3: Test Integration System

1. Sign in as Logan McNeil (lmcnei/).

46 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.


Field Name Entry Value

Starting Availability Date 01/01/2020

Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

I0 Activity Complete I

XSLT for Workday 47


Confidential © 2021 Workday, Inc.
XSLT for Workday

CHAPTER 5 - RESTRUCTURE ELEMENT NESTING

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

By the end of this chapter, you will be able to:

• Restructure XML nesting.


• Explain when to use the identity transformation.

HOW TO EXTRACT FIELDS

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>

Syntax What it Example


Outputs

<xsl:copy-of All child <wd:ID


select="*"/> elements wd:type="WID">54c5b697lffb4bf0bll6fe765lec789a</wd:ID>
including <wd:ID wd:type="ISO_3166-1_Alpha-2_Code">FR</wd:ID>
tags, <wd:ID wd:type="ISO_3166-1_Alpha-3_Code">FRA</wd:ID>
attributes, <wd:ID wd:type="ISO_3166-l_Numeric-3_Code">250</wd:ID>
and text

<xsl=copy/> Element tag <wd:Country_Reference/>

<xsl:copy> Element tag <wd:Country_Reference>54c5b697lffb4bf0bll6fe765lec789a


and child FR FRA 250</wd:country_Reference>
<xsl:value- text

48 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

Syntax What it Example


Outputs
of
select="*"/
>
</xsl:copy>
<xsl=value- Child 54c5b697lffb4bf0bll6fe765lec789a FR FRA 250
of element
select="*"/ text only
>

XSLT for Workday 49


Confidential © 2021 Workday, Inc.
XSLT for Workday

� ACTIVITY 5.1 - COMPARE METHODS TO EXTRACT


� FIELDS (OPTIONAL)
: Business Case: The Get Candidates EIB uses the Get Candidates web service operation to
: output candidate data. In preparation for creating an XSLT file, compare the XSLT elements
! copy-of, copy, and using copy with value-of select.

Task #1: Run the EIB

1. Sign in as Logan McNeil (/mcnei�.

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.

5. Click OK to accept the default parameters.

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.

Task #2: Add Custom Transformation

1. Open the candidates_compare_statements.xsl file.

2. View the contents, especially noting the template for wd:Contact_Data/


wd: Location_Data/wd:Country_Reference.

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.

5. In the Name field, enter Get Candidates XSLT.

6. Add the updated candidates_compare_statements.xsl file.

7. Click OK and Done.

50 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

8. Navigate to the Get Candidates (EIB) integration and select its Related Actions and
then Enterprise Interface > Edit.

9. Update the Transform settings:


Field Name Entry Value

Transformation Type Custom Transformation


Custom Transformation Get Candidates XSLT

10. Click OK to save the changes.

11. Launch the integration system and view the output file.

12. Compare the different output for each element type.

I0 Activity Complete I

XSLT for Workday 51


Confidential© 2021 Workday, Inc.
XSLT for Workday

MODIFYING XML NESTING

Use the following tips to change the structure of your output:

• Use templates to specify only the elements you want to output.


• To include existing tags, use <xsl:copy> or <xsl:copy-of>. Otherwise, use <xsl:value-of>
and write out the new open and closing tags.

CREATE AN ATTRIBUTE

To add a new attribute, use the <xsl:attribute> element. For example:

<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}"/>

52 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

ACTIVITY 5.2 - MODIFY ELEMENT NESTING AND


ATTRIBUTES
: Business Case: A new vendor uses candidate skills to provide recruiters with data on the
• types of candidates interested in open positions at GMS. The integration system already
exists in the tenant, but currently it outputs raw data from the Get Candidates web service
operation. Create an XSLT file to transform the data so that it outputs with the following
structure:
<?xml version="l.0" encoding="UTF-8"?>
<wd:root xmlns:wd="urn:com.workday/bsvc">
<wd:Candidate ID="CAND ID">
<wd:First_Name>First Name</wd=First_Name>
<wd:Last_Name>Last Name</wd:Last_Name>
<wd:Full_Name>First Name Last Name</wd:Full_Name>
<wd:Skills>
<wd:Skill_Name>Skill l</wd:Skill_Name>
<wd:Skill_Name>Skill 2</wd:Skill_Name>
<wd:Skill_Name>Skill 3</wd:Skill_Name>
</wd:Skills>
</wd:candidate>

Task #1: Modify XSLT File

1. Open the candidates _start.xsl file.

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.

A. Statement #1 - Add an attribute to the wd:Candidate tag named ID that contains


the wd:Candidate ID value

B. Statement #2 - Output the child elements (wd:First_Name and wd:Last_Name),


including both text and tags. In the output file, this will display separate First
Name and Last Name tags.

C. Statement #3 - Output the child elements (wd:First_Name and wd:Last_Name)


text only. In the output file, this will display one tag for Full Name that contains
the first and last name text.

XSLT for Workday 53


Confidential © 2021 Workday, Inc.
XSLT for Workday

D. Statement #4 - Output the wd:Skill_Name child elements, including tag and text.

3. Save the updated file.

Task #2: Test Integration

1. Sign in as Logan McNeil (Jmcneil).

2. Run the Create XSLT Attachment Transformation task.

3. In the Name field, enter Candidates E/8 XSLT.

4. Click Select Files and upload your updated XSLT file. Click OK.

5. Navigate to the Get Candidates (EIB) integration system.

6. Select the integration system's Related Actions and then Enterprise Interface > Edit.

7. In the transform section, in the Transformation Type field, select Custom


Transformation.

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.

10. Accept the default parameters and click OK.

11. Again, accept the default launch parameters and click OK.

12. When the integration completes, select the Output Files tab.

13. Download the GetCandidates.xml file and view the results.

I 0 Activity Complete I

54 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

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.

The following template is the identity transformation:

<xsl:template match="@* I node()">


<xsl:copy>
<xsl:apply-templates select="@* I node()"/>
</xsl:copy>
</xsl:template>

Note: The XPath used in the identity transformation includes:


• The@ symbol, which selects attributes, and the* symbol, which selects all
element nodes. Using@* together matches any attribute node.
• The node() expression, which matches any node of any kind.
• The pipe ( I ) character, which is like an AND, used to select several paths.
For more information, view the XPath Syntax page on W3Schools.

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.

XSLT for Workday 55


Confidential © 2021 Workday, Inc.
XSLT for Workday

� ACTIVITY 5.3 - USE THE IDENTITY TRANSFORMATION


� (OPTIONAL)
• Business Case: The vendor requirements changed for the Get Candidates (EIB) outbound
• integration. They would like a full file with all the raw web service response data except for a
: few reformatted fields. Use the identity transform to extract the data as is with only the
: following specific formatting changes:
• Remove the First-Name and Last- Name elements and add a Full-Name element.
• Simplify the Job_Applied_To_Data element so that it only contains the Requisition_lD.
• Remove the Resume-Attachment-Data element and all child elements.
• Remove the Prospect_Data element and all child elements.

Task #1: Modify XSLT File

1. Open the GetCandidates.xml file.

2. Open the candidates_identity_transform.xsl file.

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:

A. Remove the First-Name and Last-Name elements and add a Full-Name


element.

B. Simplify the Job_Applied_To_Data element so that it only contains the


Requisition ID.

C. Remove the Resume-Attachment-Data element and all child elements.

D. Remove the Prospect_Data element and all child elements.

4. Save your modified XSLT file.

Task #2: Test Integration

1. Sign in as Logan McNeil (lmcneil).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the Get Candidates XSLT attachment transformation and click OK.

56 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

4. Click the trash can icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the Get Candidates (EIB) integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters and click OK.

9. Again, accept the default launch parameters and click OK.

10. When the integration completes, select the Output Files tab.

11. Download the GetCandidates.xml file and view the results.

I@ Activity Complete I

XSLT for Workday 57


Confidential © 2021 Workday, Inc.
XSLT for Workday

CHAPTER 6 - ADD CONDITIONAL LOGIC AND FUNCTIONS

OVERVIEW

T his chapter outlines how to apply conditional logic statements, custom functions, and date
formatting.

OBJECTIVES

By the end of this chapter, you will be able to:

• Add conditional logic to the XSLT transformation to exclude or target specific records.
• Describe when to use variables, parameters, and custom functions.

IMPORT DATA WITH EIB AND XSLT

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.

58 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

XSLT FOR INBOUND WWS

The XSLT for an inbound operation needs to select va llues from the input file to produce the web
service request.

Jm.l. T�r�1or••1 O" encod.!.z:,r.-"OTP'-1"?


<x.,:.1 ,�v1e,h«t. r,l:21t 1 a,1-"'httP I/ywy,xJ,onz/1999/ISL /Iran1rocw.. v�r,:.o::-"' 2. o ..>
a5l:ou�pu� 1r�•r.t••ye•• s.,,;Jio •"1111.1"/>
4 ••1:�•rrpl•e- a.�«-•root" u�r.•:x,1•·bstr;/t,,w;,wJ,orn/20Ct/XNLX,,_.,a-101ten�·>
,cc:t>
1<••1:tcr-••Ch ••l•��••�lo�.. a:n�ry•
<b••e:R..t.lnt•in Cc«'&tacry.to1a&t161)._t0t_r.e1•on�tver.t_a.CJLl••t L••c:Y1ra10�• v2t.o•
tlTC!:......i �-#-•tat.a" �U a ta �• QtO!CC. a VOrkd&y/baYO">
<b�?c:Ma�nta1n Coccact Intoraat10�_1>aca>

b5TCl :o t •·-- :s.i:!e--"r:.ploy;;.; l;;.


""'_::D• >....,__
... �
�l ;v•lu.-e-ot: !'iel-e:r;:••eaploy-eenlO"/>J
,.,.,,.., uh
</bt•�:w�r��r-�•t•r����>
◄b.-vc:trfecti'H_Dat•�<x•l:Yal�•-of ••l•ci•�curr-a:n�•d.lle(>•t></bavc:!rfectLv•_Datt>
<bavc:Vort•x_c ntacc_tnCo:u�1on_o.��>
<e�•c:Elr.a11 Ad.dr••• Da�a
<bsvctt.n.&.1! Ad:1.r�,�
L!!11valJe-ot �e.� t•"caall aclclTc.e�
<lbs•c1t:aa�l_��r��s
<l>=c,�11_c�nt 1-port.ed Vta lnt.<!9Tattoa /i,.,,,c,EIM�l_Ceoracn�>
<b�;·.:.sa-,e O.t• •v-·r1t- •t.nJe"
<beYe:tYS.-_t..t• ••• • i • .. ,1•"t�•
�•v�:T;r•_J•t•r�n�• � �:t•1cripit-0z•�>">
...b.vc: :o b : t.;.�•• '"Coaauttlc.lt.ion_oa.aqe._type_lD '" WORX /'t:.•�= ID>
<lb•vc:7;�• aer•r•nce>
<ll>•vc:Type_Data
</b5TCIO:oaoc_Dato>
<l1>avc1!:IIA1l_A011J:c5•_Data>
<lb5TC1Wcrtcr_Coetoct_lnf�a..,�100_hto>
</b,vc;ff�1nt•1c_to.,tee:_Infonr,t1on_O.ta>
<Jb,Y::X.1eta1n_Coctact_Intcnut1��-for_f,re:�_tv,nt_��q-��•t►
<ls.al: f<:r-••::.'"i>
</tOCt>

XSLT

CONFIGURE INBOUND EIB USING WWS

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.

XSLT for Workday 59


Confidential © 2021 Workday, Inc.
XSLT for Workday

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>

60 XSLT for Workday


Confidential© 2021 Workday, Inc.
G:i
XSLT for Workday

ACTIVITY 6.1 - USE CHOOSE-WHEN LOGIC

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.

Task #1: Modify XSLT File

1. Open the employee_emails_update.xml and the maintain_contact_info.xsl files.

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".

6. Save the updated style sheet.

Task #2: Create XSLT Attachment

1. Sign in as Logan McNeil (lmcneil).

2. Run the Create XSLT Attachment Transformation task.

3. In the Name field, enter Employee Email E/8 XSLT.

4. Click the Select Files button and add the updated XSLT file.

5. Click OK and Done.

Task #3: Create EIB to Maintain Contact Emails

1. Search for Create E/8 and select Create EIB from the Tasks results.

2. Select Inbound.

XSLT for Workday 61


Confidential© 2021 Workday, Inc.
XSLT for Workday

3. In the Name field, enter WICT EIB Employee Email.

4. Click OK.

5. Click Next to access the Get Data page and edit the Data Format section.

6. Specify a File Type of None.

7. Click Next to access the Transform page.

8. Edit the Transform section.

9. Select the Custom Transformation Transformation Type.

10. In the Custom Transformation field, select the Employee


Email EIB XSLT attachment transformation that you created previously.

11. Click Next to access the Deliver page.

12. Edit the Deliver section.

13. Select the Workday Web Service Operation Delivery Method.

14. From the Workday Web Service Operation prompt, select Maintain Contact
Information (Web Service).

15. Click Next to review the summary.

16. Click OK.

Task #4: Launch EIB to Update Employee Emails

1. From the EIB's Related Actions, select Integration > Launch I Schedule.

2. Click OK to accept Run Now.

3. In the Integration Criteria table, in the Integration Attachment row, click the Value column
prompt and select Create Integration Attachment.

4. Click Select Files and upload the employee_emails_update.xml file.

5. Click OK.

6. Click OK again to launch the integration.

7. In the Integration Details tab, scroll to check the number of records successfully
processed.

62 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

8. In the Messages tab, select the EIB Transformation message.

9. Click the transform_result.zip file to download the file.

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.

11. To verify the success of the integration in Workday, look up employees


21142 and 21223 in the tenant and view their contact information. Click the Contact
section and then confirm that Aidan's updated email is Work (Primary) and that Brian
Kaplan's is Home (Primary).

Hint: Enter the employee number directly in the search box to quickly locate the
employee's. page.

8 Email Address
��.wotMav.iw

Aidan Mitzner (21142) new email address

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.

For example, the template below formats a number.

<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=""/>

64 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

... insert function instructions...

</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.

XSLT for Workday 65


Confidential © 2021 Workday, Inc.
XSLT for Workday

111]1J ACTIVITY 6.2 - FORMAT DATE FIELDS

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.

Task #1: Call Date Template

1. Open the positions_date.xsl file.

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.

B. Step #2: Use the xsl:call-template function to call the stripTimeFromDate


template for the wd:Avail_Date element.

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.

Task #2: Update Output File Type to XML

1. Sign in as Logan McNeil (/mcnei/).

2. Navigate to the WICT EIB Positions integration system.

3. Select the integration system's Related Actions and then Enterprise Interface > Edit.

4. Navigate to the Deliver section.

5. In the File Name field, replace txt with xml so it is positions.xm/.

6. Click OK.

Task #3: Test Integration System

66 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

1. Sign in as Logan McNeil (/mcneil).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration > Launch /
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.


Field Name Entry Value

Starting Availability Date 01/01/2020


Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

I 0 Activity Complete j

XSLT for Workday 67


Confidential © 2021 Workday, Inc.
XSLT for Workday

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.

Task #1: Call Date Function

1. Open the positions_date_function.xsl file.

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.

Task #2: Test Integration System

1. Sign in as Logan McNeil (/mcnei/).

2. Run the Edit XSLT Attachment Transformation task.

3. Select the WICT Positions EIB XSLT attachment transformation and click OK.

4. Click the Delete icon to delete the existing XSLT file.

5. Click Select Files and insert your updated XSLT file. Click OK.

6. Navigate to the WICT EIB Positions integration system.

7. Select the integration system's Related Actions and then Integration> Launch/
Schedule.

8. Accept the default parameters of Run Now and click OK.

9. Select the following report parameters and click OK.

68 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

Field Name Entry Value

Starting Availability Date 01/01/2020

Ending Availability Date Today's Date

10. When the integration completes, select the Output Files tab.

11. Download the positions file and view the results.

I0 Activity Complete I

XSLT for Workday 69


Confidential© 2021 Workday, Inc.
XSLT for Workday

CHAPTER 7 - IMPROVE PERFORMANCE WITH XSLT 3.0

OVERVIEW

This chapter introduces the main benefits of XSLT 3.0 and how to use the streaming method.

OBJECTIVES

By the end of this chapter, you will be able to:

• Compare XSLT version 2.0 and 3.0.


• Apply principles to improve performance of an XSLT transformation.
• Follow standards for writing XSLT 3.0.

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.

HOW STREAMING WORKS

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:

• All XPath must be motionless, meaning it cannot look back or forward.


• The order of the data in the output document will match the source document order.
• You must declare each element you want to output in its own template.

Note that you can get around the above limitations by using burst mode and other advanced
features.

XSLT STREAMING MODES

XSLT 3.0 uses an element called mode. Use the mode element to specify:

70 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

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.

On-no-match Value Definition


shallow-skip Ignores the node but applies templates to its attributes and children.
deep-skip Ignores the node and all its descendants.
shallow-copy Copies the element node and applies templates to its attributes and
children.
deep-copy Performs a copy-of.

HOW TO USE STREAMING

To use XSLT 3.0 with streaming, apply the following charnges to an XSLT 2.0 transformation:

• Change the versiorn number to 3.0.


<xsl:stylesheet version="3.0">
• Add the mode element. Set the streamable attribute to "yes". Set the on-no-match
attribute to "shallow-skip" so that when there is not a match for a template, the
processor performs a shallow skip.
<xsl:mode streamable="yes" on-no-match="shallow-skip"/>
• Create a separate template for each nested level and child element that you need to
output.

STREAMING IDENTITY TRANSFORMATION

To apply the identity transformation in an XSLT 3.0 style sheet, use the statement <xs 1: mode
on-no-match="shallow-copy"/>.

XSLT for Workday 71


Confidential© 2021 Workday, Inc.
XSLT for Workday

� ACTIVITY 7.1 - MODIFY POSITIONS


� TRANSFORMATION TO USE STREAMING (OPTIONAL)
,,,,,,,, ..... , ,. , , ,, ...................................................
Business Case: The WICT EIB Positions integration outputs more employees than scoped for.
, Create a streaming XSLT transformation for the WDINST RW EIB Positions with RBOs report.

Task #1: Modify XSLT File

1. Open the positions_streaming.xsl file.

2. The style sheet applies a streaming transformation to the positions_report.xml file. Note
the following components:

A. The style sheet version is 3.0.

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.

Task #2: Launch Integration to View Output

1. Sign in as Logan McNeil (lmcnei/).

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 and click OK.

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.

6. Select the positions_report.xml integration service attachment and click OK.

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.)

8. Navigate to the Workday Studio XSLT Streaming Attachment integration system.

72 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

9. Launch the integration system and view the output.

I0 Activity Complete I

XSLT for Workday 73


Confidential © 2021 Workday, Inc.
XSLT for Workday

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:mode streamable="no" name="memory-mode">


<xsl:template match="wd:Report_Entry">
<xsl:apply-templates select="copy-of()" mode="memory-mode">

</xsl:template>

Or:

<xsl:template match="wd:Report_Entry" mode="memory-mode">

</xsl:template>

74 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

l[?IJ ACTIVITY 7.2 - USE BURST MODE


·•···· ···"•· .. ·· · · ······ · · · · ·· ·· . . . . .. . - . . . . .. - · · · · ······ . . - - , . . . . . . . , . , . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

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.

Task #1: Apply Burst Mode

1. Open the positions_streaming_burst.xsl file.

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.

A. Step 1: Set the style sheet version to 3.0.

B. Step 2: Add an xsl:mode element that sets streamable to yes and on-no-match to
shallow-skip.

C. Step 3: Set a variable to hold a copy of the current report entry.

D. Step 4: Include the variable in each XPath statement in the template.

3. Once you finish, save the updated file.

4. Compare your saved file with the positions_streaming_burst_answer.xsl file.

Task #2: Launch Integration to View Output

1. Sign in as Logan McNeil (/mcneil).

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.

XSLT for Workday 75


Confidential © 2021 Workday, Inc.
XSLT for Workday

5. Navigate to the Workday Studio XSLT Streaming Attachment integration system.

6. Launch the integration system and view the output.

Task #3: Create Burst Mode Without a Variable

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.

A. Modify the template so that it matches on only wd:Report_Data instead of


wd:Report_Entry.

B. Add a for-each statement within the template with the following syntax:

<xsl:for-each select="wd:Report_Entry/copy-of( )"/>

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

76 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

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.

The following table outlines the required components to declare an accumulator.

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)

Streamable Indicates if it is streamable.

The following code shows an example of how to declare an accumulator.

<xsl:accumulator name="sumPay" as="xs:decimal" initial-value="O"


streamable="yes ff >
<xsl=accumulator-rule match="wd=Pay/text( )" select="$value +
xs=decimal(. )"/>
</xsl:accumulator>

XSLT for Workday 77


Confidential © 2021 Workday, Inc.
XSLT for Workday

� ACTIVITY 7.3 - CALCULATE A SUM AND AVERAGE


� WITH ACCUMULATORS
I Business Case: The positions output file now needs to include the average pay of the workers
I included in the report. Use accumulators to calculate total pay across all workers and the
I number of workers included in the file. Then use these values to calculate the average pay.
• Add a summary section to the beginning of the output file that displays the calculations.

Task #1: Create Accumulators

1. Open the positions_streaming_burst.xsl file.

2. Add two accumulators to the XSLT file:

A. Sum of the total pay for all filled positions

B. Count of the number of filled positions {the positions that have pay listed)

3. Add a running total of the sum after each employee.

4. Add a summary to the end of the file that reports the following:

A. Sum

B. Count

C. Average

5. Once you finish, save the updated file.

6. Compare your saved file with the positions_streaming_accumulator.xsl file.

Task #2: Launch Integration to View Output

1. Sign in as Logan McNeil (/mcneil).

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.

78 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday 79
Confidential Cl 2021 Workday, Inc.

4. Click the trash can icon to remove the existing file. Then u

5. Navigate to the Workday Studio XSLT Streaming Attach

6. Launch the integration system and view the output.

I @ Activity Complete I
XSLT for Workday

APPENDIX A - WORKDAY PRO

WORKDAY PRO STUDIO

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.

In addition to enhanced product expertise, additional Workday Pro benefits include:

• Update training with each Workday release at no additional cost.


• Access to the Workday Touchpoints Kit, a toolkit that illustrates the connection points
across all product areas to aid in design considerations.
• Access to a private Workday Pro User Group in Workday Community.

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.

• Workday Pro Community Page: Learn more about the program.


• Workday Pro Course Matrix: Understand which classes qualify for a Workday Pro track.
• Workday Pro Manager Proposal: Help your manager understand the benefits of
Workday Pro for both you and your organization.
• Workday Pro FAQ

Workday Pro Studio


8 credits total I Each track requires an enrollment fee of 1 training credit

• •
Report Calculated Workday Integration XSLTfor Introduction to Advanced
Writer F ields System Fundamentals Workday Workday Studio Workday Studio

1.Scredits 1 credit 1 credit 1 credit 1 credit 1.5 credits

80 XSLT for Workday


Confidential© 2021 Workday, Inc.
XSLT for Workday

APPENDIX 8 - RESOURCES

NOTEPAD++
I

1 . Launch Notepad ++.

2. Select the Plugins menu option and then Plugins Admin.

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.

5. When Notepad ++ opens, open your XML and XSLT files.

6. Ensure the namespaces are the same in both files.

7. Navigate to the Plugins menu option> XML Tools> XSL transformation.

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.

COMMON XSLT ISSUES


Issue Resolution

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.

XSLT for Workday 81


Confidential © 2021 Workday, Inc.

You might also like