AnsweredAssumed Answered

How do I Insert an Attribute?

Question asked by samos2 on Feb 10, 2014
Latest reply on Feb 23, 2016 by cappmfan


Background:
I'm trying to write a gel script which xogs out a project, performs manipulations and additions, and xogs it back in.

What's working:
Xogging out
Manipulating attributes which do exist
Xogging back in.

What's not working:
Adding attributes to the 'Project' element which don't exist in the xog-out, but which do exist in "prj_projects_write.xml", such as entityCode, and billExpenseType, etcetera.

I've tried the following, and I just know I'm doing something stoopid, but I don't know what!!! (And I don't get xsl/xslt enough, yet). Can I actually insert an attribute to the Project in this way?

In each case, the error I get is 'org.apache.commons.jelly.JellyTagException: null:260:86: <gel:set> Missing or invalid XML'

Here's a cut down version of my script, with the trouble hitting on GEL line trying to set @billExpenseType to value 'CAP_EXPENSE'.

What is the correct syntax I should be using?

     <gel:forEach select="$runresult//Projects/Project" var="v_item">
      <core:if test="${DEBUG>1}">
       <gel:set asString="true" select="$v_item/@projectID" var="v_xog_project_id"/>
       <gel:log category="XOG" level="INFO">Project:${v_xog_project_id}</gel:log>
      </core:if>
      
      <!-- set those which should already be there -->
      <gel:set select="$v_item/@financialStatus" value="O"/>

      <!-- this gel:set causes the exception -->
      <core:catch var="gel_error">
       <gel:set value="CAP_EXPENSE" select="$v_item/@billExpenseType" insert="true"/>
      </core:catch>
      <core:if test="${gel_error != null}">
       <gel:log category="GEL" level="WARN">Gel Error: ${gel_error}</gel:log>
      </core:if>

On the offending gel:set line, I've tried
<gel:set value="CAP_EXPENSE" select="$v_item/@billExpenseType" insert="true"/>
as well as without the @
<gel:set value="CAP_EXPENSE" select="$v_item/billExpenseType" insert="true"/>

but both give me the same exception...

Outcomes