The include-self and insert-before attributes

<xoom:set> also supports include-self, insert-before and guard attributes.

include-self

If set to false (default), the include-self attribute indicates that only the content of the <xoom:set> elements should be deployed (at the node specified by the select attribute).

If it is set to true then the node specified by the select attribute will be included in the deployment, together with content of the <xoom:set> elements. A typical use case is when the content of the <xoom:set> elements is empty and the information is contained in an attribute of the selected node. For example:
<Setting xoom:id="Setting[[Application]|Events|W6BFTask|]">
  <Owner>[Application]</Owner>
  <Category>Events</Category>
  <SubCategory>W6BFTask</SubCategory>
  <Name />
  <xoom:set select="Body/Events/Event[@Type='Diabsolut.Product.ClickSchedule.SchedulePriority.SetSchedulePriority, 
                    DiabsolutPT.ClickSchedule.SchedulePriority']" include-self="true">
    <Event Type="Diabsolut.Product.ClickSchedule.SchedulePriority.SetSchedulePriority, DiabsolutPT.ClickSchedule.SchedulePriority" Active="true" />
  </xoom:set>
</Setting>
    

insert-before

The insert-before attribute allows you to specify a location where the content will be deployed, assuming the XPath specified by the select attribute resolves to a node. For example, here the new <Event> content is inserted before the first Event: insert-before="Event[1]".
<Setting xoom:id="Setting[[Application]|Events|W6BFTask|]">
  <Owner>[Application]</Owner>
  <Category>Events</Category>
  <SubCategory>W6BFTask</SubCategory>
  <Name />
  <xoom:set select="Body/Events/Event[@Type='Diabsolut.Product.ClickSchedule.SchedulePriority.SetSchedulePriority, 
                    DiabsolutPT.ClickSchedule.SchedulePriority']" include-self="true" insert-before="Event[1]">
    <Event Type="Diabsolut.Product.ClickSchedule.SchedulePriority.SetSchedulePriority, DiabsolutPT.ClickSchedule.SchedulePriority" Active="true" />
  </xoom:set>
</Setting>
    

guard

The guard attribute takes the value of an XPath, that, if resolved, returns the value true and allows deployment to occur. If it returns the value false, deployment is prevented.

guard is used to prevent Xoom automatically creating and populating a new node when the XPath specified by the select attribute can't be resolved. For example, you may not want a new Agent Instance to be created when the node does not exist: the guard attribute prevents this.

In this example, we have set the guard attribute to have the same value as select.


Example of using the guard attribute