As an integration developer working with Workday, you are tasked with transforming the output of an Enterprise Interface Builder (EIB) that calls the Get_Job_Profiles web service operation. The XML provided shows the response from this operation, and you need to write XSLT to format the element within the section. Specifically, you need to output the date "2024-05-15" (as seen in the XML) in the format "15-07-2024" (day-month-year). The root template of your XSLT matches on and applies templates to . You are using the format-date XPath function, which follows the syntax: format-date($value as xs:date?, $picture as xs:string). Let’s analyze the XML, the requirement, and each option to determine the correct XPath syntax.
Understanding the XML and Requirement
The provided XML snippet shows a response from the Get_Job_Profiles web service operation in Workday, formatted in SOAP XML with the Workday namespace (xmlns:wd="urn:com.workday/bsvc"). Key elements relevant to the question include:
It contains , which includes elements.
Within , there is , which contains with the value 2024-05-15.
You need to transform this date into the format "15-07-2024" (DD-MM-YYYY), where:
The format-date function in XPath 2.0 (used by Workday) formats a date value according to a picture string. The syntax is:
First parameter: The date value (e.g., wd:Job_Profile_Data/wd:Effective_Date), which must be an xs:date or convertible to one.
Second parameter: The picture string (e.g., '[D01]-[M01]-[Y0001]'), specifying the format using patterns like:
The question specifies that the root template matches and applies templates to , so the XPath must navigate to within that context.
Analysis of Options
Let’s evaluate each option based on the format-date syntax, the XML structure, and the required output format "15-07-2024":
Option A: format-date('[D01]-[M01]-[Y0001]’, wd:Job_Profile_Data/wd:Effective_Date)
This option places the picture string ('[D01]-[M01]-[Y0001]') as the first parameter and the date value (wd:Job_Profile_Data/wd:Effective_Date) as the second. However, the format-date function requires the date value as the first parameter and the picture string as the second, per the syntax format-date($value, $picture). Reversing the parameters is incorrect and will result in an error or unexpected output, as format-date expects an xs:date? first. Thus, this option is invalid.
Option B: format-date (wd:Job_Profile_Data/wd:Effective_Date, '[D01]-[M01]-[Y0001]')
This option correctly follows the format-date syntax:
First parameter: wd:Job_Profile_Data/wd:Effective_Date, which points to the element in the XML (e.g., 2024-05-15). This is an xs:date value, as Workday web services typically return dates in ISO format (YYYY-MM-DD), which format-date can process.
The XPath wd:Job_Profile_Data/wd:Effective_Date is correctly nested under the context, as the template matches on . This would transform "2024-05-15" into "15-05-2024" (or "15-07-2024" if the month is adjusted in the logic), matching the required day-month-year format. This option is valid and correct.
Option C: format-date (wd:Job_Profile_Data/wd:Effective_Date, '[M01]-[D01]-[Y0001]')
This option also follows the correct format-date syntax, with the date value first and the picture string second. However, the picture string '[M01]-[D01]-[Y0001]' specifies a month-day-year format:
[M01] outputs the month first (e.g., "05" for May).
Option D: format-date('[M01]-[D01]-[Y0001]’, wd:Job_Profile_Data/wd:Effective_Date)
Similar to Option A, this option reverses the parameters, placing the picture string ('[M01]-[D01]-[Y0001]') first and the date value (wd:Job_Profile_Data/wd:Effective_Date) second. As explained earlier, format-date requires the date value as the first parameter, so this syntax is incorrect and will not work as intended. This option is invalid.
Why Option B is Correct
Option B correctly uses the format-date function with the proper syntax:
It places the date value (wd:Job_Profile_Data/wd:Effective_Date) as the first parameter, referencing the element in the XML.
It uses the picture string '[D01]-[M01]-[Y0001]' as the second parameter, which formats the date as "DD-MM-YYYY" (e.g., "15-05-2024" for the XML’s "2024-05-15," or "15-07-2024" as specified, assuming a month adjustment in the transformation logic).
The XPath is appropriate for the context, as the template matches , and is a valid path within it.
The question’s mention of "15-07-2024" suggests either a hypothetical adjustment (e.g., the EIB or XSLT logic modifies the month to July) or a test case variation. Since the XML shows "2024-05-15," the format-date function would output "15-05-2024" with the given picture string, but the principle of formatting day-month-year remains correct. Workday’s XSLT implementation supports such transformations, and the format-date function is well-documented for this purpose.
Practical Example in XSLT
Here’s how this might look in your XSLT:
This would process the (e.g., "2024-05-15") and output "15-05-2024," aligning with the day-month-year format requested (adjusted for the hypothetical "07" if needed elsewhere in the logic).
Verification with Workday Documentation
The Workday Pro Integrations Study Guide and SOAP API Reference (available via Workday Community) detail the use of XPath functions like format-date for transforming web service responses. The Get_Job_Profiles operation returns job profile data, including effective dates, in ISO format, and XSLT transformations are commonly used in EIBs to reformat data. The format-date function’s syntax and picture string patterns (e.g., [D01], [M01], [Y0001]) are standard in XPath 2.0, as implemented in Workday’s integration tools.
Workday Pro Integrations Study Guide References
Section: XSLT Transformations in EIBs– Describes using XSLT to transform web service responses, including date formatting with format-date.
Section: Workday Web Services– Details the Get_Job_Profiles operation and its XML output structure, including .
Section: XPath Functions– Explains the syntax and usage of format-date($value, $picture), including picture string patterns like [D01], [M01], and [Y0001].
Workday Community SOAP API Reference – Provides examples of date formatting in XSLT for Workday web services.
Option B is the verified answer, as it correctly applies the format-date function to format the in the required day-month-year format.