Question & Answer
Question
XPath - how to create attributes for elements when the element contains no text. *|* -BCE46525827C75C085257918000B05FC- *|*
Answer
Technote (troubleshooting)
Problem(Abstract)
XPath - how to create attributes for elements when the element contains no text.
Symptom
The goal is to create 12 nodes in ?ProcessData each with an attribute containing a month of the year. The previous node is being overwritten by the node that follows it. The assign statements have the append property set to true. When the BP completes the only node that is present is the one for December. January through November?are overwritten. Below is a portion of the BP and along with a sample of the desired output.
<process name="test_convert_num_Month_2_Text">
<sequence name="Sequence Start">
<assign name="Assign" to="/Month/month/@monthnum" from="'January'" append="true"></assign</span>
<assign name="Assign" to="/Month/month/@monthnum" from="'February'" append="true"></assign>
<assign name="Assign" to="/Month/month/@monthnum" from="'March'" append="true"></assign>
<assign name="Assign" to="/Month/month/@monthnum" from="'April'" append="true"></assign>
</sequence>
</process>
This is an example of how the file should look:
<ProcessData>
<Month>
<month monthnum="January"/>
<month monthnum="February"/>
???????????? :
<month monthnum="November"/>
<month monthnum="December"/>
</Month>
</ProcessData>
No errors but?the ProcessData does not contain the desired output.
Resolving the problem
?When creating attributes Gentran Integration Suite and Sterling Integrator require that an element already exist to give the attribute something to "hang its hat on."
For example running the following business process:
<process name="testAssigns">
<sequence name="Sequence Start">
<assign to="Month/month" from="."/>
<assign to="Month/month/@monthnum" append="true">January</assign>
<assign to="Month/month" from="." append="true"/>
<assign to="Month/month/@monthnum" append="true">February</assign>
<assign to="Month/month" from="." append="true"/>
<assign to="Month/month/@monthnum" append="true">March</assign>
<assign to="Month/month" from="." append="true"/>
<assign to="Month/month/@monthnum" append="true">April</assign>
</sequence>
</process>
yields the following output:
<ProcessData>
<Month>
<month monthnum="January"/>
<month monthnum="February"/>
<month monthnum="March"/>
<month monthnum="April"/>
</Month>
</ProcessData>
| Segment | Product | Component | Platform | Version | Edition |
|---|---|---|---|---|---|
| Commerce | Sterling B2B Integrator | Adapters |
Historical Number
NFX9908
Product Alias/Synonym
Escalation ID
00221160
Severity
Normal
Type
NormalFix
Was this topic helpful?
Document Information
Modified date:
13 October 2021
UID
ibm10769551