advanced-create-your-transformations-xpath-advanced

Version 1.1 by eMagiz on 2022/05/05 10:04

XPath Advanced

Within the crash course, we already explained XPath conceptually. In that same microlearning, we also looked at some more uncomplicated cases of using XPath within your transformation. If you need to brush up on that knowledge, please check out this [microlearning](crashcourse-platform-create-transformation-xpath-basic.md). In the intermediate microlearning on this subject, we built upon that knowledge. Please check out this [microlearning](intermediate-create-your-transformations-xpath-intermediate.md) if you need a refresher on that. In this microlearning, we will build upon that knowledge and look at some concrete, practical examples that could be useful in your project.Should you have any questions, please get in touch with academy@emagiz.com.
  • Last update: October 25th, 2021
  • Required reading time: 6 minutes

1. Prerequisites

  • Advanced knowledge of the eMagiz platform
  • [XPath Basic](crashcourse-platform-create-transformation-xpath-basic.md)
  • [XPath Intermediate](intermediate-create-your-transformations-xpath-intermediate.md)
crashcourse-platform-create-transformation-xpath-basic crashcourse-platform-create-transformation-XPath-basic

2. Key concepts

This microlearning focuses on more complex XPath operations.With XPath Advanced, we mean learning that XPath options are complex but could benefit you in your daily work.Some of the more complex XPath options are:
  • dateTime calculation
  • Filter list
  • XPath on JSON
  • SpEL notation for XPath

3. XPath Advanced

Within the crash course, we already explained XPath conceptually. In that same microlearning, we also looked at some more uncomplicated cases of using XPath within your transformation. If you need to brush up on that knowledge, please check out this [microlearning](crashcourse-platform-create-transformation-xpath-basic.md). In the intermediate microlearning on this subject, we built upon that knowledge. Please check out this [microlearning](intermediate-create-your-transformations-xpath-intermediate.md) if you need a refresher on that. In this microlearning, we will build upon that knowledge and look at some concrete, practical examples that could be useful in your project.Some of the more complex XPath options are:
  • dateTime calculation
  • Filter list
  • XPath on JSON
  • SpEL notation for XPath

3.1 dateTime calculation

Sometimes we see that a dateTime calculation is needed within a transformation to determine a specific action. As these calculations are not natively supported within the eMagiz platform, you need to use XPath's functionality to calculate the new valid date (or dateTime).The XPath standard offers several functions to calculate with dateTime values. The two most used options are dayTimeDuration and yearMonthDuration. With the help of the dayTimeDuration, you can add, subtract, multiple, or divide seconds, minutes, hours, and days regarding the original value. The yearMonthDuration works similarly but then for months and years. An example of such an XPath is: