gel:set - Certain usages of XPath with text() do not work
search cancel

gel:set - Certain usages of XPath with text() do not work

book

Article ID: 217490

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

We have the following usage of text() function in XPath in our Gel Scripts. We notice that it works in version 15.8.1 but not in 15.9.2.

Example:

<gel:script
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
 <gel:parse var="varGroups">
  <groups>
  <group code="DS23">Team Leaders</group>
  </groups>
 </gel:parse>
 <gel:set asString="true" select="$varGroups/groups/group/@code/text()" var="groupCode"/>
 <gel:log> Code: ${groupCode} </gel:log>
</gel:script>

Environment

Version: 15.9.2 and above

Cause

Wrong usage of text() in XPath.

Resolution

  • This usage have worked in a previous clarity version. However, with the upgrade since 15.9.2, the existing code needs to be updated in order to work.
  • The correct usage is also documented in gel:set Setting XML Document Values

Correct Usage Example:

<gel:script
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
 <gel:parse var="varGroups">
  <groups>
  <group code="DS23">Team Leaders</group>
  </groups>
 </gel:parse>
 <gel:set asString="true" select="$varGroups/groups/group/@code" var="groupCode"/>
 <gel:log> Code: ${groupCode} </gel:log>
</gel:script>

Additional Information

The JAXEN library has been upgraded to 1.2.0. The wrong usage of text() in XPath does not work with this upgraded library and documented in our Change & Impact Guide and under our Gel script documentation under section gel:set Setting XML Document Values