The item element has an is-multi attribute for specifying multi-value properties. If a property is an array, Collection, or Map, you should set this attribute to true. The output XHTML document will include all of the values of the property.

For example, in a Commerce product catalog, a product item will typically have a multi-valued childSKUs property whose values are the various SKUs for the product. You might specify the property like this:

<item property-name="childSKUs" is-multi="true">
  <text-properties>
    <property name="displayName"/>
    <property name="description"/>
  </text-properties>
</item>

The output document will include the displayName and description value for each SKU.

For properties that are Maps, the situation is more complex, because each Map entry has a key and a value. To specify how to output the Map entries, you use the map-iteration-type attribute. The value of this attribute can either be entries or values.

If map-iteration-type="values", only the values of the Map entries are output. Essentially, the values are treated as an array or Collection, and the keys are ignored. The values must be repository items, and the text-properties element is used to specify the properties of those items to output. For example:

<item property-name="someMap" is-multi="true" map-iteration-type="values">
  <text-properties>
    <property name="name"/>
    <property name="age"/>
    <property name="height"/>
  </text-properties>
</item>

If map-iteration-type="entries", both the keys and the values of the Map are output; each Map entry is treated as if it were a repository item with two properties, key and value. The values of value can be either repository items or simple values such as primitives or Strings. For simple values, you can specify the output like this:

<item property-name="someMap" is-multi="true" map-iteration-type="entries">
  <text-properties>
    <property name="key"/>
    <property name="value"/>
  </text-properties>
</item>

If the values of value are repository items, you treat the items as child items of the Map entry. For example:

<item property-name="someMap" is-multi="true" map-iteration-type="entries">
  <text-properties>
    <property name="key"/>
  </text-properties>
  <item property-name="value">
    <text-properties>
      <property name="color"/>
      <property name="size"/>
      <property name="weight"/>
    </text-properties>
  </item>
</item>

Note that you can use map-iteration-type="entries" to display just the keys or just the values, by omitting the other tag.

 
loading table of contents...