What is a multi-value element?
- The shortest definition of a multi-value element is:
An element for which there is a value with position > 1.
- The long definition of a multi-value element is:
An element that has more than one value for a single product and at least 2 of those values share the same wrapper value if it is an immersed element.
However, this is quite hard to imagine, so let’s explain it with examples.
Example 1
<IMAGE1>url1</IMAGE1>
<IMAGE2>url2</IMAGE2>
It is not a multi-value element. Both elements have exactly one value, both with position 1. The path to the value url1
is IMAGE1 { @@POSITION = 1 }
, and to the value url2
is IMAGE2 { @@POSITION = 1 }
.
Example 2
<IMAGES>
<IMAGE>url1</IMAGE>
<IMAGE>url2</IMAGE>
</IMAGES>
In this case, IMAGES
is not a multiple element, but IMAGE
is a multi-value element. Because the IMAGE
element has a value with position > 1 (IMAGES | IMAGE { @@POSITION = 2}
), or the IMAGE
element has more than one value for a product (url1
, url2
) and the two values share the same value of the wrapper element (IMAGES
).
Example 3
<g:product_detail>
<g:attribute_name>Materiál</g:attribute_name>
<g:attribute_value>Porcelán</g:attribute_value>
</g:product_detail>
<g:product_detail>
<g:attribute_name>Objem</g:attribute_name>
<g:attribute_value>460 ml</g:attribute_value>
</g:product_detail>
<g:product_detail>
<g:attribute_name>Barva</g:attribute_name>
<g:attribute_value>Černá</g:attribute_value>
</g:product_detail>
In this example from Google format, g:product_detail
is a multiple element, but neither g:attribute_name
nor g:attribute_value
are multi-value elements. Why?
For g:product_detail
, there is a value with position 1, 2, and 3 (e.g., g:product_detail { @@POSITION = 2 }
). The values are immersed elements, but that’s okay.
For g:attribute_name
and g:attribute_value
, the conditions from the definition do not apply.
For the Material value, the path is g:product_detail { @@POSITION = 1 } | g:attribute_name { @@POSITION = 1 }
.
For the Volume value, the path is g:product_detail { @@POSITION = 2 } | g:attribute_name { @@POSITION =1}
.
Example 4
<RELATED_FILE>
<TEXT>...</TEXT>
</RELATED_FILE>
<RELATED_FILE>
<TEXT>...</TEXT>
</RELATED_FILE>
It is a similar example to the previous one. The RELATED_FILE
element is a multiple element, but the TEXT
element is not a multi-value element.