Use the XPath Name property to filter elements in a structure based on an attribute value.
About this task
In this example, you have an XML file containing information about orders. Each
order
element has a status
attribute. You want
to configure the structure to only process orders with the status
pending
.
You could do this by creating a map with a filter on the output loop, but setting a filter in the structure using the XPath Name property can be useful if you want this filter to be automatically applied in all maps that use this structure as input.
You can use the following XML
sample:
<orders>
<order status="pending">
<orderId>189465984</orderId>
<customer>
<lastName>Smith</lastName>
<firstName>Jane</firstName>
</customer>
</order>
<order status="completed">
<orderId>189465971</orderId>
<customer>
<lastName>Doe</lastName>
<firstName>John</firstName>
</customer>
</order>
<order status="pending">
<orderId>189465987</orderId>
<customer>
<lastName>Jones</lastName>
<firstName>Lauren</firstName>
</customer>
</order>
</orders>
Procedure
Results
<orders>
<order status="pending">
<orderId>189465984</orderId>
<customer>
<lastName>Smith</lastName>
<firstName>Jane</firstName>
</customer>
</order>
<order status="pending">
<orderId>189465987</orderId>
<customer>
<lastName>Jones</lastName>
<firstName>Lauren</firstName>
</customer>
</order>
</orders>