ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

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

book

Article ID: 217490

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

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">SWAT Team</group>
  </groups>
 </gel:parse>
 <gel:set asString="true" select="$varGroups/groups/group/@code/text()" var="groupCode"/>
 <gel:log> Code: ${groupCode} </gel:log>
</gel:script>

Cause

Wrong usage of text() in XPath.

Environment

Version: 15.9.2

Resolution

This usage might have worked in a previous version of the product. However, since 15.9.2, a corrected version such as the one below would have to be used. The correct usage is also documented in the page being mentioned below.

Correct Usage:

<gel:script
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
 <gel:parse var="varGroups">
  <groups>
    <group code="DS23">SWAT Team</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