Elements in Mergado#

1. What are elements#

Definition#

An element is the basic building block of a feed that carries data. Each element represents a specific piece of information – for example, a product name, price, code, or image. In both XML and CSV, an element serves as a label for where a given value is located.

In simple terms:

  • element = “name of the information”,
  • value = “content of that information”.

Example:

<g:title>Bid long and prosper – hrnek</g:title> <g:price>364.21 CZK</g:price> <g:id>47</g:id>

In this example:

  • <g:title> is the element,
  • “Bid long and prosper – hrnek” is its value.

Elements in different formats#

Element in an XML feed#

In XML files, an element is everything located between an opening and closing tag. An element can contain text, attributes, or other elements (known as nesting). XML is a hierarchical format – which allows it to describe even complex relationships between data.

Example:

<PRICE_VAT>1499</PRICE_VAT>

The element PRICE_VAT contains a single value – the price including VAT.

Element in a CSV feed#

In CSV files, an element corresponds to a single column in a table. The column name represents the element, and the cells in the column represent its values.

Example:

PRODUCTNAME PRICE_VAT EAN
Hrnek Mergado 1499 8592384021932

CSV cannot handle nesting (parent–child), so Mergado simulates this structure using the notation parent | child.

Element in Mergado Editor#

In Mergado Editor, each element corresponds to a single row on the Elements page. The Editor displays the feed structure as a tree – that is, in a hierarchy where nested elements are shown with indentation.

Each element in Mergado can be:

  • simple, if it has only one value,
  • multiple, if it repeats multiple times (e.g., multiple images, multiple parameters),
  • nested, if it is part of another element,
  • or attribute-based, if it supplements the main value with additional information (e.g., @id or @description).

What elements are used for#

Elements are the foundation for transferring, processing, and editing data in Mergado. They help organize data so that it can be:

  • read, modified, and exported,
  • converted between formats (e.g., Heureka → Google Merchant),
  • sorted, filtered, and evaluated.

In practice, you work with them when:

  • creating product queries,
  • setting up rules,
  • working with variables and automation,
  • sorting and reviewing data on the Products and Elements pages.

Summary#

An element is the basic unit of data in a feed. Mergado treats it uniformly regardless of format – whether it comes from XML, CSV, or another source. Understanding how elements work and how they relate to each other is key to working effectively with rules, queries, and exports.

FAQ#

What is an element?#

An element is the basic building block of a feed that carries specific information – such as a name, price, or product code. In both XML and CSV formats, it represents the label for where a given value is located.

What is the difference between an element and a value?#

An element is the name of the information (e.g., PRICE_VAT), while the value is its content (e.g., 1499). Together they form a pair – a name and its data content.

What does an element look like in an XML feed?#

In XML, an element is defined by an opening and closing tag. Example:

  • <PRICE_VAT>1499</PRICE_VAT>

Here, PRICE_VAT is the element and 1499 is its value.

How does an element work in a CSV feed?#

In a CSV file, an element corresponds to a column name. Each cell in that column represents the element’s value. Example:

  • PRICE_VAT → a column with values 1499, 1599, 1799, etc.

How is nesting expressed in CSV when CSV does not support hierarchy?#

Mergado simulates nesting in CSV using the notation parent | child. For example, the path PARAM | VAL represents the value of the element VAL nested under the element PARAM.

How does Mergado Editor display elements?#

In Mergado Editor, each element is displayed as a separate row on the Elements page. Nested elements are visually indented and form a tree structure that corresponds to the XML feed structure. This also applies to the Products page in the Elements view.

What types of elements does Mergado distinguish?#

Mergado works with four basic types:

  • Simple elements – have one value.
  • Multiple elements – can have multiple values.
  • Nested elements – are part of another element.
  • Attribute elements – supplement the element with additional information (e.g., @id).

What are elements used for in Mergado?#

Elements are the foundation for working with data – they are used for reading, editing, filtering, exporting, and converting data. They are essential when working with rules, queries, variables, and automation.

Are elements the same across all formats?#

Yes. Mergado treats them uniformly – regardless of whether they come from XML, CSV, or another format.

Why is it important to understand elements?#

Because almost all work in Mergado (queries, rules, calculations, exports) is based on elements. Understanding elements means being able to precisely control data editing and processing.


2. Element basics#

Types of elements#

Mergado distinguishes four basic types of elements. Each has specific behavior and usage options.

1. Simple elements#

  • Have one value.
  • Their position (@@POSITION) is always equal to 1.
  • When working with them, there is no need to specify the position.

Example:

<ITEM_ID>47</ITEM_ID>

The path ITEM_ID targets the same value as ITEM_ID { @@POSITION = 1 }.

2. Multiple elements#

  • Contain multiple values of the same type.
  • Each value has its own position (1, 2, 3 …).
  • To target a specific value, conditions or the attributes @@POSITION and @@VALUE are used.

Example:

<IMAGE>url1.jpg</IMAGE> <IMAGE>url2.jpg</IMAGE>

The element IMAGE has two values – at position 1 and 2.

Multiplicity is commonly found, for example, with images, shipping methods, parameters, or categories.

3. Nested elements#

  • Are inside another element (called the parent).
  • Create a hierarchical data structure.
  • In Mergado, nesting is displayed with indentation, and in the element path using the pipe character |.

Example:

<PARAM> <PARAM_NAME>Barva</PARAM_NAME> <VAL>Černá</VAL> </PARAM>

The path to the value is:

  • PARAM | VAL

This notation specifies that the value VAL is located inside the element PARAM.

4. Attribute elements#

  • An attribute is supplementary information that extends the meaning of an element.
  • In XML, it is specified in the opening tag and denoted with the @ symbol.
  • In Mergado, attributes are commonly used and written using paths with @.

Example:

<IMAGE description=”Zimní bunda”>obrazek.jpg</IMAGE>

Path to the attribute:

  • IMAGE | @description

How to view elements in Mergado Editor#

The Elements page#

On the Elements page, you will find a complete overview of all elements in the project. Here you can:

  • show and hide elements (for the output feed),
  • add, delete, or rename elements (for user-created elements),
  • sort by name or by structure,
  • view their input and output values.

Clicking on an element name opens a detailed overview of all its values.

The Products page#

On the Products page, elements can be displayed in two ways:

  • ”Elements” view – displays all elements and their values for a specific product.
  • ”Table” view – allows you to select specific elements and display them in a clear table.

The Element Path tool (Element-Path)#

On the Elements page and in rules, you can use the Element Path tool, which helps create the correct path and verify its validity. It shows you exactly where the path leads and makes it easier to work with rules or queries.

Summary#

Elements are the basic unit that Mergado works with. They are distinguished by their function (simple, multiple, nested, attribute-based), and understanding them is key to working effectively with rules, queries, and the feed structure.

FAQ#

What types of elements exist in Mergado?#

There are four basic types:

  • Simple – have one value.
  • Multiple – contain multiple values.
  • Nested – are located inside another element.
  • Attribute – supplement the value with additional information.

What does element position mean?#

Each element value has its position (e.g., first, second, third value). For simple elements, the position is always 1; for multiple elements, it can be higher.

How do you work with multiple elements?#

Multiple elements (e.g., IMAGE) can have multiple values. To work with them, conditions or special attributes @@POSITION (targeting by order) and @@VALUE (targeting by content) are used.

How do I recognize a nested element?#

A nested element is located inside another element (called the parent). In the element path, it is denoted using the pipe character |, for example PARAM | VAL.

How are element attributes written?#

Attributes are written using the at sign @. Example:

  • <IMAGE description=”Zimní bunda”>obrazek.jpg</IMAGE>

In Mergado, the path to this attribute is IMAGE | @description.

In some feed formats (e.g., Ceneo), attributes are also specified on the wrapper element.

  • <o id=”123” price=”100” avail=”1”> <name>Název produktu</name> … </o>

In this case, the path to these attributes in Mergado is @id, @price, @avail. And if you want to create a new attribute on the wrapper element in Mergado, you add it on the Elements page as a new row, not by using the plus icon on an existing element.

Where can I find elements in Mergado?#

On the Elements page in the project’s left menu. Here you can display, hide, add, or sort elements by structure.

How do I view the values of a specific element?#

By clicking on its name on the Elements page, you open an overview of all its values – both input and output.

How are elements displayed on the Products page?#

On the Products page, you can choose:

  • Elements view – all elements and their values for a specific product,
  • Table view – a clear listing of selected elements in a table.

What is the Element Path tool (Element-Path)?#

Element-Path, or Element Path, is a language developed by Mergado that is used to write paths to elements and their values. Using Element-Path, you specify which values in the feed you want to target – whether you will read them or write to them.

Mergado Editor works with elements just like an XML feed – in a tree structure. To precisely identify which data you want to work with in this structure, you need to know their path. This is exactly what the Element-Path language enables.

What is the difference between a simple and a multiple element?#

A simple element has one value for all products (e.g., ITEM_ID). A multiple element has several values (e.g., multiple IMAGE tags) for a single product – and these values can be worked with individually using Element-Path.

3. Element nesting#

What is nesting#

Nesting is a property of an element that determines its placement in the hierarchy of an XML feed. An element is considered nested if it is located in the XML between the opening and closing tags of another element. Nesting creates a structure that helps maintain clarity and logical relationships between data.

This principle has practical significance – elements that are nested within each other usually are related and form a single unit. You will encounter such structures, for example, with product parameters, categories, or shipping providers.

Example:

<PARAM> <PARAM_NAME>Barva</PARAM_NAME> <VAL>Černá</VAL> </PARAM>

In this case:

  • PARAM_NAME is the parameter name,
  • VAL is its value,
  • PARAM is the parent element that connects both.

Thanks to this structure, Mergado recognizes that the value “Černá” belongs to the parameter “Barva”.

Parents, children, and siblings#

Nested elements form relationships that correspond to the tree structure of XML:

Relationship type Description
Parent The element into which another element is nested.
Child The element that is inside another element.
Siblings Elements that share the same parent.

Example of relationships:

PARAM | PARAM_NAME PARAM | VAL

  • PARAM is the parent.
  • PARAM_NAME and VAL are its children.
  • PARAM_NAME and VAL are siblings of each other.

In Mergado Editor, this relationship is visually represented by indentation – children are always shifted to the right relative to the parent on the Elements and Products pages.

How Mergado works with nested structures#

Mergado Editor works with elements by adopting and displaying the XML feed structure in its natural tree form. Each element retains information about its parent and children, which makes it possible to:

  • precisely distinguish which values belong together,
  • correctly target a specific value (e.g., PARAM | VAL),
  • create and manage new nested elements directly in the Editor interface.

On the Elements page, you can add new nested elements by clicking the “+” icon next to the parent element. An element created this way is empty and is only populated using a rule (e.g., Rewrite).

For better orientation, you can think of the structure as folders and files:

  • the parent element is a folder,
  • the child is a file or subfolder inside it.

For example, the path PARAM | VAL means that the value VAL is located inside the element PARAM.

CSV and nesting#

Nesting is a natural property of formats like XML or JSON, but CSV format cannot express it natively. Therefore, Mergado simulates nesting in CSV using the notation parent | child, so that data can be worked with in the same way as in XML.

In practice, this means that in a CSV file, each column represents a path to an element. For example:

PARAM | PARAM_NAME PARAM | VAL

This notation expresses that the element VAL is nested under the element PARAM. In this way, Mergado can preserve logical relationships between data even in formats that do not natively support nesting.

In practice: working with nesting in Mergado Editor#

1. Writing a path to a nested element#

When you want to work with a nested element in a rule or query, you write its path using the pipe character |.

Example:

  • PARAM | VAL

This notation means: “Find the element PARAM and within it the child VAL.” Spaces before and after the pipe character must be maintained.

  • Correct: PARAM | VAL
  • Incorrect: PARAM|VAL

2. Precise targeting using a condition#

If the element PARAM has multiple values (e.g., multiple parameters), it is advisable to add a condition for more precise targeting. Conditions are written in curly braces { } and filter values according to the specified criterion.

Example:

  • PARAM { PARAM_NAME = “Typ displeje” } | VAL

This notation says: “Find the element PARAM that has a child PARAM_NAME with the value Typ displeje, and modify its value VAL.” This way you target exactly the desired parameter regardless of its position in the feed.

Difference between XML and CSV when processing nesting#

Property XML feed CSV feed Display in Mergado
Nesting support Yes, natively. No, Mergado simulates it. Yes, through a tree structure.
Displaying relationships Using tags and indentation. Using column names. Using indentation on the Elements and Products pages.
Path notation Using tags. `Parent Child`.

While XML expresses nesting through markup and nested tags, CSV uses path notation with the | delimiter. Mergado unifies both structures and allows you to work with them in the same way.

Summary#

Nesting is a fundamental principle of working with data in Mergado Editor. It allows you to recognize how values of individual elements relate to each other, and thus precisely target rules and queries.

A proper understanding of nesting is key to working effectively with parameters, shipping providers, variants, and other multiple structures. Whether you work with an XML or CSV feed, Mergado can display, preserve, and utilize nesting for all types of edits.

FAQ#

What is element nesting?#

Nesting is a property of an element that indicates it is located inside another element. This relationship creates a data hierarchy – for example, the element PARAM (parent) can contain parameter names and values (PARAM_NAME and VAL), which are its children. The terms nested and embedded mean the same thing.

What is nesting used for?#

Nesting helps maintain a logical and clear data structure. It allows you to unambiguously assign values to their context – for example, that the parameter “Barva” has the value “Černá”. This makes it possible to unify related information into a single structure.

What relationships are used in a nested structure?#

Nested elements form three types of relationships:

  • Parent – an element that contains other elements.
  • Child – an element that is inside another element.
  • Siblings – elements that share the same parent.

Example: in the path PARAM | VAL, PARAM is the parent and VAL is its child.

What does a nested element look like in XML?#

In XML, nesting is expressed using nested tags. Example:

<PARAM> <PARAM_NAME>Barva</PARAM_NAME> <VAL>Černá</VAL> </PARAM>

The element PARAM is the parent, PARAM_NAME and VAL are its children.

How does Mergado display nested elements?#

Mergado Editor displays elements in a tree hierarchy that corresponds to the XML feed structure. Nested elements are indented to the left relative to their parent. You can see nesting, for example, on the Products and Elements pages. A new nested element can be created by clicking the “+” icon next to the parent element.

How is nesting written in Element-Path?#

Nesting is written using the pipe character | between element names. Example:

PARAM | VAL

This notation means that VAL is a child of the element PARAM. Spaces before and after the pipe character must be preserved.

  • Correct: PARAM | VAL
  • Incorrect: PARAM|VAL.

How is nesting expressed in CSV format?#

CSV format cannot express hierarchy natively, so Mergado simulates nesting using the notation parent | child. For example, PARAM | PARAM_NAME and PARAM | VAL express the same relationship as in the XML structure.

Which file types can handle nesting?#

The formats XML and JSON naturally work with nesting. CSV format does not natively support nesting, but Mergado Editor helps it do so using the parent | child notation.

What is the maximum number of nesting levels?#

There is no theoretical limit on nesting depth. In practice, Mergado has encountered up to nine levels of nesting, for example in feeds in the Upgates format.

How to precisely target the value of a nested element?#

For precise targeting, a condition in the path is used. Example:

PARAM { PARAM_NAME = “Typ displeje” } | VAL

This notation says: “Find the element PARAM that has a child PARAM_NAME with the value Typ displeje, and work with its element VAL.” This method is the most reliable because it works regardless of the order of elements in the feed.

How to target when an element is both multiple and nested?#

If an element is multiple (e.g., PARAM repeats multiple times), you need to use a condition. The path PARAM | VAL without a condition targets all values, but precise targeting is achieved with: PARAM { PARAM_NAME = “Barva” } | VAL

Why is targeting through a child more reliable than using @@POSITION?#

Targeting through a child (e.g., PARAM_NAME = “Barva”) is more reliable because it selects the correct value regardless of its position in the list. The @@POSITION attribute only refers to order, so if the order of parameters differs between products, it can lead to incorrect results.

Why is working with nesting important?#

Most complex data, such as parameters, shipping, or variants, is nested. A proper understanding of nesting allows you to work with data precisely, create reliable rules, and keep the feed logically structured and clear.

4. Element multiplicity#

What a multiple element means#

A multiple element is an element that has multiple values with the same name. From the perspective of feed structure, this means that within a single product, the given element appears repeatedly – for example, with images, parameters, or variants.

Multiplicity allows you to unify multiple related values under a single element name, so there is no need to create new elements for each value separately.

You will most commonly encounter multiple elements with:

  • image URLs (e.g., IMGURL_ALTERNATIVE),
  • product parameters (PARAM),
  • shipping (DELIVERY),
  • categories,
  • product variants.

Example in XML structure:

<IMGURL_ALTERNATIVE>url1.jpg</IMGURL_ALTERNATIVE> <IMGURL_ALTERNATIVE>url2.jpg</IMGURL_ALTERNATIVE>

In this case, the element IMGURL_ALTERNATIVE is multiple because it has more than one value.

Difference between a simple and a multiple element#

Property Simple element Multiple element
Number of values Only one value. Multiple values with the same name.
Value position Always equal to 1. Each value has its own position (2, 3 …).
Path notation No need to specify position. To target a specific value, a condition or the @@POSITION attribute must be used.
Examples ITEM_ID, DESCRIPTION, PRICE_VAT IMAGE, PARAM, DELIVERY, IMGURL_ALTERNATIVE

In nested structures (e.g., PARAM), multiplicity applies to the parent element. Children (typically PARAM_NAME and VAL) remain simple because within a single parent they always have only one value.

How Mergado works with positions#

Each element value has its ordinal number, or position (1, 2, 3 …). The position can be used for precise targeting of a specific value within an element.

For working with positions, Mergado uses the special attribute @@POSITION. It is part of the Element-Path language and allows you to specify which position within an element you want to target.

Example:

<IMAGE>url1.jpg</IMAGE> @@POSITION = 1 <IMAGE>url2.jpg</IMAGE> @@POSITION = 2 <IMAGE>url3.jpg</IMAGE> @@POSITION = 3

If you want to work with the third image, use the path:

  • IMAGES | IMAGE { @@POSITION = 3 }

This notation says: “I am working with the element IMAGE at the third position.”

Limitations of the @@POSITION attribute#

The @@POSITION attribute only refers to order, not content. If the order of values differs across products, the same positions may not correspond to the same information.

Example:

  • The first product has parameters 1. Material, 2. Volume.
  • The second product has 1. Material, 2. Decor.

The path PARAM { @@POSITION = 2 } | VAL would then refer to Decor for the second product, not Volume.

It is therefore safer to target by name:

  • PARAM { PARAM_NAME = “Objem” } | VAL

How to work with multiplicity in Mergado Editor#

Finding and using position#

  1. On the Elements page, open the given element and you will see all its values with their positions.
  2. In rules or queries, you can target:
    • by position, e.g., IMGURL_ALTERNATIVE { @@POSITION > 1 },
    • or by a range of positions, e.g., IMGURL_ALTERNATIVE { @@POSITION >= 3 AND @@POSITION <= 8 }.
  3. If you want to work with the value instead of the position, use the @@VALUE attribute, for example:
    • CATEGORY { @@VALUE != “Hračky” }
  4. This notation selects all values of the element CATEGORY that are not equal to “Hračky”.

When you do not need to specify position#

You do not need to specify position in the path in the following cases:

  1. Simple elements
    1. They always have only one value, so position = 1. The path ITEM_ID is equivalent to ITEM_ID { @@POSITION = 1 }.
  2. Reading from a multiple element without specification
    1. If you read from a multiple element in a rule without a condition, Mergado automatically uses the first value.
    2. For example: when using %PARAM | VAL%, Mergado takes the first value.
  3. Targeting all values
    1. If you want to process all occurrences of an element, use only the element name without a condition.
    2. E.g., IMAGES | IMAGE works with all images.
    3. When writing, keep in mind that the change will be applied to all values matching the given path.

Summary#

Multiplicity allows storing and processing multiple values of the same type within a single element. For precise work, it is advisable to target specific values using conditions or special attributes. This ensures that edits are performed correctly and do not affect other data.

FAQ#

What is a multiple element?#

A multiple element is an element that has multiple values with the same name. In practice, this means it appears repeatedly within a single product – for example, with images, parameters, shipping, or categories. Typical multiple elements are IMAGE, PARAM, DELIVERY, or CATEGORY.

What is the difference between a simple and a multiple element?#

  • A simple element contains one value and always has a position equal to 1.
  • A multiple element can have multiple values, each with its own position (2, 3, 4 …).

Example: <IMAGE>url1.jpg</IMAGE> <IMAGE>url2.jpg</IMAGE>

The element IMAGE is multiple because it appears more than once and contains multiple values.

What is multiplicity used for?#

Multiplicity allows you to unify multiple related values under a single element name. There is no need to create new elements for each value separately. For example, all alternative product images can be written as repeating IMGURL_ALTERNATIVE elements.

Which elements are typically multiple?#

Multiplicity most commonly occurs with elements that describe repeating product properties, for example:

  • Image URLs (IMGURL_ALTERNATIVE),
  • product parameters (PARAM),
  • shipping (DELIVERY),
  • categories,
  • product variants.

How does Mergado work with value positions?#

Each element value has its position, i.e., an ordinal number (1, 2, 3 …). The position can be used for precise targeting of a specific value within an element. The special attribute @@POSITION is used for this. Example: IMAGES | IMAGE { @@POSITION = 3 }

This notation means: “I am working with the element IMAGE at the third position.”

What does the @@POSITION attribute mean and how is it used?#

@@POSITION determines the order of a value inside a multiple element. It is used in conditions for targeting a specific position or range of positions. Example: IMGURL_ALTERNATIVE { @@POSITION > 1 }

This notation targets all alternative images except the first. However, keep in mind that @@POSITION only works with order, not content. If the order differs between products, it may target an incorrect value.

What is the @@VALUE attribute and when to use it?#

@@VALUE represents the content of the element’s value and allows targeting by value instead of position. It is used especially with elements that have no children, such as CATEGORY or IMGURL_ALTERNATIVE. Example: CATEGORY { @@VALUE != “Hračky” }

This notation selects all categories except “Hračky”.

How to target values of multiple elements in Element-Path?#

Targeting is done using conditions in curly braces { }. These can use the attributes @@POSITION, @@VALUE, or expressions from the MQL language. Targeting all values: IMAGES | IMAGE

  • Processes all values (url1, url2, url3 …).

Targeting specific values or a range of positions: IMAGES | IMAGE { @@POSITION IN (3;4) }

  • Targets the third and fourth image.

How to find value positions in Mergado Editor?#

On the Elements page, you can view all values of each element including their positions. This overview helps you better understand the structure of multiple data and makes targeting in rules easier.

When is it not necessary to specify position in the path?#

Position does not need to be specified in these cases:

  • Simple elements – always have one value (position = 1). ITEM_ID is equivalent to ITEM_ID { @@POSITION = 1 }.
  • Reading from a multiple element without a condition – Mergado automatically uses the first value. E.g., %PARAM | VAL% takes the first value.
  • Targeting all values – just specify the element name without a condition, e.g., IMAGES | IMAGE.

What is the difference between targeting by position and by value?#

  • @@POSITION works with the order of the value.
  • @@VALUE works with the content of the value.

If the order of values differs across products, it is safer to use @@VALUE because it targets the content directly.

What is the problem with targeting using @@POSITION?#

@@POSITION only refers to order. If products have parameters in a different order, the path may target an incorrect value. It is safer to use targeting by child name, for example: PARAM { PARAM_NAME = “Objem” } | VAL

How to work with multiple elements in rules and queries?#

Working with multiple elements depends on whether the rule reads from the element or writes to it. Reading:

  • If the path leads to multiple values, Mergado uses the first one.
  • If you want to read a different value, you need to specify the path with a condition.

Writing:

  • If a rule writes to a multiple element, the change is applied to all values matching the given path.
  • If you want to write only to a specific value, you need to restrict the path using a condition.
  • If the condition contains the = operator or the AND conjunction, Mergado creates the missing structure automatically.

Why is it important to distinguish multiplicity?#

Multiplicity means that an element can contain multiple values of the same type. Understanding this principle is essential for correctly setting up rules, queries, and precise targeting of specific data within a feed.

5. Working with multiple elements in Mergado rules#

Multiple elements behave differently in Mergado Editor than simple elements. Each product can contain multiple values of the same element, so it is important to know how rules work with them – how they read values, write values, and how to target them correctly.

How rules read and write multiple values#

A multiple element is one that has more than one value for a single product. Rules in Mergado (for example, Rewrite, Bulk copy values, Calculation) have defined default behavior in such cases.

Reading from elements and variables#

If a rule reads a value from a multiple element whose path leads to multiple values, Mergado automatically uses only the first value.

This behavior applies when reading using the percent sign % notation (e.g., %PARAM | VAL%).

Example:

<VAL>Černá</VAL> <VAL>XL</VAL>

If the rule reads from the path PARAM | VAL, Mergado takes only the first value “Černá”. For simple elements (e.g., ITEM_ID), this logic has no effect because there is always only one value.

Writing to elements#

If a rule writes to a multiple element without further specification, Mergado writes the value to all occurrences of the given element.

Example:

  • If you use the path IMGURL_ALTERNATIVE in a Rewrite rule and enter the new value novy_obrazek.jpg,

Mergado overwrites all existing values of this element.

If you want to write only to a specific value, you need to specify the path using conditions. For example, the path

  • PARAM { PARAM_NAME = “Barva” } | VAL

writes the value only to the “Barva” parameters. If the “Barva” parameter appears multiple times in one product, the change is applied to all those occurrences.

When to use a condition and when a special attribute#

For precise targeting of a specific value of a multiple element, you need to add a condition. Conditions work as a filter – they determine which values or positions the rule applies to. They are written in curly braces { } and can contain either a nested element or a special attribute.

1. Using a nested element in a condition#

This method is the most reliable because it targets a value based on its content, not its order.

Example: We want to rewrite the value of the element VAL that belongs to the parameter “Barva”:

  • PARAM { PARAM_NAME = “Barva” } | VAL

This notation says: “Find all elements PARAM that have a child PARAM_NAME with the value Barva, and modify the value of the element VAL within them.”

This method works regardless of the order of elements in the feed and is therefore recommended in most cases.

2. Using the special attribute @@POSITION#

The @@POSITION attribute is used for targeting a value by its order. Each element value has its position – first = 1, second = 2, etc.

Example:

IMGURL_ALTERNATIVE { @@POSITION > 1 }

This notation targets all images except the first.

Suitable use: For elements where the order of values corresponds to their meaning (e.g., alternative images).

Weakness: Targeting with @@POSITION only refers to position, not content. If the order of values changes across products, the result may not be consistent.

3. Using the special attribute @@VALUE#

The @@VALUE attribute refers to the actual value of the element, not its order. It is suitable where the order changes or is not important.

Example:

  • CATEGORY { @@VALUE != “Hračky” }

This notation targets all values of the element CATEGORY except “Hračky”.

@@VALUE is used primarily with elements that have no children (e.g., CATEGORY, IMGURL_ALTERNATIVE). For parent elements that do not carry a value themselves (e.g., PARAM), using it does not make sense.

Practical path examples#

Rules in Mergado use the Element-Path language when working with elements (reading/writing), which allows precise targeting of the values you want to read from or write to.

Targeting the value of a specific parameter#

  • PARAM { PARAM_NAME = “Barva” } | VAL

This notation reads or writes the value VAL for the parameter whose name is Barva.

Mergado interprets this as follows: “Find the element PARAM that has a child PARAM_NAME with the value Barva, and modify the value of its child VAL.”

Targeting a value in variants#

A path can combine multiple levels of nesting and multiplicity. Example for working with the second variant that contains the parameter “Velikost”:

  • VARIANTS | VARIANT { @@POSITION = 2 } | PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE

This notation says: “Find the second variant of the product, in which the parameter Velikost carries a certain value, and work with that value.”

Adding new values using rules#

When writing to multiple or nested elements, one important rule applies: If the element you are targeting does not yet exist, Mergado will create it.

This means that everything specified in the condition (e.g., PARAM_NAME = “Barva”) and in the path with the = operator is created automatically.

Example of adding a new structured value – a so-called “flag”:

Element: FLAGS | FLAG { CODE = “action” } | ACTIVE

New value: 0

If a flag with the code action does not exist, Mergado creates a new FLAG (a new position) with the element CODE = “action” and adds the element ACTIVE with the value 0 to it.

This mechanism is used when adding new variants, shipping providers, parameters, or other structured data.


Overview of rules affected by multiplicity#

The described reading and writing behavior for multiple values applies to these rules:

Rule Can read Writes
Rewrite :white_check_mark: :white_check_mark:
Find and replace :white_check_mark: :white_check_mark:
Bulk rewriting by query :white_check_mark: :white_check_mark:
Bulk rewriting by values :white_check_mark: :white_check_mark:
Bulk copy values :white_check_mark: (Source element) :white_check_mark:
Set product parameters :white_check_mark: :x:
Set shipping rates :white_check_mark: :x:
Set UTM parameters :white_check_mark: :x:
Calculation :white_check_mark: :white_check_mark:
Data file import :x: :white_check_mark:

Summary#

When working with multiple elements in Mergado Editor rules, the most important thing is to know which value you are working with. Without specification, a rule always reads the first value and writes to all matching values. Using conditions, special attributes @@POSITION and @@VALUE, or a combination of multiple nesting levels, you can precisely determine what the rule modifies.

A correctly written element path ensures that edits are performed exactly where they should be – and remain safe even if the feed structure changes over time.

FAQ#

What is the basic principle of how rules work with multiple elements?#

Rules in Mergado Editor work with multiple elements based on two principles – reading values and writing values. Simple elements always have only one value, so the rule works with them directly. However, multiple elements can have several values for a single product, so it is necessary to determine which one the rule should work with. Without specification, rules read the first value and write to all values.

How does Mergado read values from multiple elements?#

If the path leads to multiple values, Mergado automatically uses only the first value. This behavior applies to all rules that read an element value using the % notation – for example, %PARAM | VAL%. Example: <VAL>Černá</VAL> <VAL>XL</VAL>

The path PARAM | VAL returns the value “Černá” because it is the first occurrence.

How does Mergado write to multiple elements?#

If a rule writes to a multiple element without further specification, Mergado writes the new value to all its occurrences (positions). If you want to target only a specific value, you need to specify the path using a condition. Example: PARAM { PARAM_NAME = “Barva” } | VAL

This notation modifies the value of the element VAL only for the “Barva” parameters. If a product has multiple “Barva” parameters, the change is applied to all those occurrences.

Why is it necessary to use conditions with multiple elements?#

Conditions work as a filter that determines which values the rule applies to. Without a condition, the rule would affect all values of the element. Conditions are written in curly braces { } and can contain either a nested element or a special attribute.

How to use a nested element in a condition?#

Targeting using a nested element is the most reliable because it relies on content, not order. Example: PARAM { PARAM_NAME = “Barva” } | VAL

This notation means: “Find the element PARAM that has a child PARAM_NAME with the value Barva, and modify the value of its child VAL.” This method works regardless of element order and is recommended in practice.

When to use the @@POSITION attribute#

The @@POSITION attribute is used for targeting by value order within an element. Each value has its position – first = 1, second = 2, etc. Example: IMGURL_ALTERNATIVE { @@POSITION > 1 }

Targets all images except the first. Use it where the order of values corresponds to their meaning (e.g., alternative images). Weakness: @@POSITION only refers to order, not content. If the order of values differs between products, results may not be consistent.

When to use the @@VALUE attribute#

The @@VALUE attribute refers to the actual value of the element and allows targeting by content instead of order. It is mainly used with elements that have no children (e.g., CATEGORY, IMGURL_ALTERNATIVE). Example: CATEGORY { @@VALUE != “Hračky” }

This notation selects all values of the element CATEGORY except “Hračky”. @@VALUE is suitable where the order of values may change or is not important.

How to combine conditions and special attributes#

Multiple conditions and attributes can be combined in a single path. Conditions can contain logical operators (AND, OR) or MQL queries. Example: VARIANTS | VARIANT { @@POSITION = 2 } | PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE

Means: “Find the second variant of the product that contains the parameter Velikost, and work with its VALUE value.”

How does Mergado create new values when writing#

If the element you are targeting does not exist, Mergado automatically creates it when writing. This applies to all conditions containing the = operator or the AND conjunction. Example: FLAGS | FLAG { CODE = “action” } | ACTIVE

If the flag “action” does not exist, Mergado creates a new FLAG element with a child CODE = “action” and adds ACTIVE with the value 0 to it. This mechanism allows automatically adding new parameters, variants, or structured data.

How to prevent errors when working with multiple values#

  • Verify that the element you are working with actually contains multiple values.
  • Use conditions { } for precise targeting.
  • Avoid relying on @@POSITION if the order of values differs between products.
  • Before writing, check that the path does not affect more values than intended.
  • Use the Element Path tool to verify where the rule targets.

6. Attributes in elements#

What are attributes#

An attribute is a part of an element that specifies its meaning or property. While the element carries the data itself, an attribute provides supplementary information about that data. Attributes thus function as extensions of element values and often help describe details that would otherwise not fit into the structure.

How attributes are written in XML#

In XML, an attribute is always specified in the opening tag of the element and has its own name and value. The attribute value must be enclosed in quotation marks or apostrophes.

Example XML notation:

<person gender=”female”> <firstname>Pavlína</firstname> <lastname>Nováková</lastname> </person>

In this example:

  • person is the element,
  • gender is the attribute,
  • female is the attribute value.

The attribute gender thus specifies information about the person – that it is a woman.

The same information could theoretically be expressed differently, using a separate nested element:

<person> <gender>female</gender> <firstname>Pavlína</firstname> <lastname>Nováková</lastname> </person>

Both notations are correct – they differ only in data structure. Attributes are typically chosen where they supplement or clarify the meaning of the main element.

What attributes are used for#

In product feeds, attributes have practical significance – they allow you to describe a product or its properties more precisely. Some advertising portals or online store platforms specifically require certain data to be provided in the form of attributes.

Examples of attribute usage in various systems#

  • Ceneo
    • Uses attributes to describe the manufacturer or other properties, for example:
      • <attrs> <a name=”Producent”>Nike</a> </attrs>
  • Heureka (Availability feed)
    • Requires attributes to add time information:
      • <delivery_time orderDeadline=”2023-04-17 12:00”>2023-04-26 12:00</delivery_time>
  • Shoptet
    • Uses attributes, for example, with images:
      • <IMAGE description=”Columbia Squish N’ Stuff (Barva Zelená, Velikost L)”>https://cdn.myshoptet.com/obrazek.jpg</IMAGE>
  • Google Shopping
    • Does not distinguish between elements and attributes but labels everything as attributes within its system.

Correct use of attributes in Mergado allows you to meet the requirements of these portals and ensure that your feed is accepted without errors.

How to work with attributes in Mergado Editor#

Mergado Editor is designed to fully support working with attributes. Attributes are one of the basic element types and can be used throughout the entire Editor environment – in rules, queries, variables, and MQL queries.

Identifying attributes#

You can recognize attributes in Mergado by the at sign @ at the beginning of the name.

  • @id – product identifier attribute,
  • @description – attribute describing an image,
  • @availability – attribute describing status or availability.

In addition to regular attributes, there are also special attributes that begin with two at signs @@. These are used in the Element-Path language for precise targeting – typically @@POSITION (value position) and @@VALUE (element value).

Tip! Special attributes are only used for targeting element and regular attribute values within Element-Path and are never exported to the feed itself, unlike regular attributes, which you will find in the feed.

Targeting attributes using Element-Path#

The Element-Path language is used for working with attributes. The path to an attribute is written using the at sign @ before the attribute name.

Example of targeting by attribute:

1. In a rule, we target the CODE element of one specific variant that contains the value idvariant3 in the id attribute of the VARIANT element:

<VARIANTS> <VARIANT id=”idvariant3”> <CODE>EEQ21</CODE> <UNIT>unit</UNIT> <FREE_SHIPPING>1</FREE_SHIPPING> <FREE_BILLING>1</FREE_BILLING> </VARIANT> <VARIANT id=”idvariant4”> <CODE>EEQ22</CODE> <UNIT>unit2</UNIT> <FREE_SHIPPING>0</FREE_SHIPPING> <FREE_BILLING>0</FREE_BILLING> </VARIANT> </VARIANTS>

The path to the given CODE element will look as follows: VARIANTS | VARIANT { @id ~ “idvariant3” } | CODE.

2. On the Products page, we are looking for a product with a default category having the attribute @id = 123:

<CATEGORIES> <DEFAULT_CATEGORY id=”123”>Spotrebice</DEFAULT_CATEGORY> <CATEGORY id=”456”>Elektronika</CATEGORY> </CATEGORIES>

The condition for the query will look as follows: CATEGORIES | DEFAULT_CATEGORY | @id = “123”.

In practice: creating, rewriting, and deleting an attribute#

Creating an attribute#

An attribute can be created directly on the Elements page.

  1. Open the Elements page and choose the New element option.
  2. Enter a name and choose the type attribute.
  3. If you add the at sign @ to the name, the Editor automatically recognizes that you want to create an attribute.
  4. If you want to create a nested attribute, use the “+” icon next to the parent element and choose the attribute type.

After creation, the attribute is empty (has no values). You can populate it, for example, using the Rewrite rule.

Rewriting an attribute value#

Attributes can be edited just like regular elements – for example, using the Rewrite rule.

Targeting: In the Element field, enter the path to the attribute, e.g.:

IMAGE | @description SHOPITEM | @id PARAM { @@VALUE = “Barva” } | @lang

Procedure: On the Rules page, create a new rule of the Rewrite type, select a product query, enter the path to the attribute, and in the New content field enter the new value.

Deleting an attribute#

Attributes can be deleted in two ways:

  1. Manually – on the Elements page, manually created attributes can be deleted using the trash icon. This deletes both the values and the attribute itself.
  2. Using rules – for attributes that come from the input or output format, only the values can be removed, using a rule (e.g., Rewrite with an empty value).

Attributes defined by the target format (so-called system attributes) cannot be renamed or deleted because they are part of the output feed specification.

Summary#

Attributes supplement the meaning of elements and allow you to describe data in the feed in more detail. In Mergado Editor, you can work with them just like regular elements – create them, change their values, and target them in rules.

Correct work with attributes is especially important for feeds targeting portals that require a precisely defined structure, such as Google, Heureka, Ceneo, or Shoptet.

FAQ#

What is an attribute in the context of XML and product feeds#

An attribute is a part of an element that specifies its meaning or property. While the element carries the data itself, an attribute provides supplementary information about that data – for example, a unit, status, or value type. In XML, an attribute is always specified in the opening tag of the element and has its name and value, which must be enclosed in quotation marks or apostrophes. Example: <person gender=”female”> <firstname>Pavlína</firstname> <lastname>Nováková</lastname> </person>

Here, person is the element, gender is the attribute, and its value is ”female”.

What are attributes used for in product feeds#

Attributes have practical significance – they allow you to more precisely describe a product or its properties. Some advertising portals and online store platforms require certain data to be provided in the form of attributes. Examples of usage:

  • Ceneo: uses attributes to identify the manufacturer (<a name=”Producent”>Nike</a>).
  • Heureka (Availability feed): attributes add time information (<delivery_time orderDeadline=”2023-04-17 12:00”>…</delivery_time>).
  • Shoptet: the description attribute describes images (<IMAGE description=”Columbia Squish N’ Stuff…”>…</IMAGE>).

Using attributes in Mergado ensures that the feed meets the requirements of the target system and is accepted without errors.

How are attributes written in XML#

An attribute is part of the opening tag of the element: <element atribut=”hodnota”>obsah elementu</element>

The attribute value must be enclosed in quotation marks or apostrophes. Example: <product available=”true”>Zimní bunda</product>

Here, the attribute available adds information about the product’s availability.

How does Mergado Editor identify attributes#

You can recognize attributes in Mergado Editor by the at sign @ at the beginning of the name.

  • @id – element value identifier,
  • @description – element value description,
  • @lang – element value language.

In addition to these regular attributes, there are also special attributes that begin with two at signs @@ (e.g., @@POSITION, @@VALUE). These are used exclusively in the Element-Path language and are never exported to the output feed.

How to target attributes using the Element-Path language#

The Element-Path language is used for working with attributes (reading, editing, filtering). The path to an attribute is written using the at sign @ before its name. Targeting examples:

When filtering products: Find products whose main category id equals 123:

  • CATEGORIES | DEFAULT_CATEGORY | @id = “123”

In a rule when targeting a specific element: Find the CODE of a variant whose @id attribute contains the text idvariant3:

  • VARIANTS | VARIANT { @id ~ “idvariant3” } | CODE

Attributes can also be used in conditions (in braces { }), where they filter specific values.

What is the difference between regular and special attributes#

In Mergado, we distinguish two types of attributes:

Attribute type Notation Usage
Standard attributes (XML) @id, @description, @availability Are part of the XML structure and define the meaning of the element.
Special attributes (Element-Path) @@POSITION, @@VALUE Used for targeting in conditions when working with multiple elements. Are not part of the output feed.

What are the special attributes @@POSITION and @@VALUE used for#

@@POSITION – corresponds to the order of the value of the element it is bound to. It is mainly used with multiple elements (e.g., images, variants). Example:

IMGURL_ALTERNATIVE { @@POSITION > 1 }

  • This notation targets all alternative images except the first.

@@VALUE – represents the content of the value of the element. It is used with elements where the order of values changes or is not important. Example:

CATEGORY { @@VALUE != “Hračky” }

  • This notation selects all categories except “Hračky”.

How to create a new attribute in Mergado#

A new attribute can be created on the Elements page.

  1. Click on New element.
  2. Enter an attribute name starting with the @ character.
  3. Mergado automatically recognizes that you are creating an attribute.
  4. If you want to create a nested attribute, use the “+” icon next to the parent element.

A newly created attribute is empty and can be populated using the Rewrite rule.

How to edit or rewrite an attribute value#

Attributes can be rewritten just like regular elements. In the Rewrite rule, simply enter the path to the attribute in the Element field. Examples:

  • IMAGE | @description
  • SHOPITEM | @id
  • PARAM { @@VALUE = “Barva” } | @value

Then enter the desired new value in the New value field.

How to delete an attribute#

Attributes can be deleted in two ways:

  • Manually: for manually created attributes on the Elements page, click the trash icon next to the attribute.
  • Using a rule: e.g., with the Rewrite rule using an empty value.

Attributes that are part of the source or target format cannot be deleted, only their values can be cleared.

What is the relationship between attributes and elements in Mergado#

In Mergado, attributes are considered a special type of element. They can be used in rules, queries, variables, and automation just like regular elements. The difference lies only in the notation (with the @ character) and their placement within the feed structure.

Why is it important to work with attributes correctly#

Correct work with attributes is crucial for feeds targeting portals that require a precise data structure – such as Google, Heureka, Ceneo, or Shoptet. Incorrectly specified or missing attributes can cause feed rejection or incomplete product display. With Mergado Editor tools, attributes can be added, changed, and verified with high precision.

7. The Element-Path language#

What is Element-Path#

Element-Path is a language developed by Mergado that is used to write paths to elements and their values. Using Element-Path, you specify which values in the feed you want to target – whether you will read them or write to them.

Mergado Editor works with elements just like an XML feed – in a tree structure. To precisely identify which data you want to work with in this structure, you need to know their path. This is exactly what the Element-Path language enables.

What “element path” means#

An element path is a notation that expresses where in the data structure the value(s) you want to work with are located. Using this path, you tell Mergado that you want to either:

  1. read the value – i.e., use it as input (e.g., in a rule or query), or
  2. change the value – i.e., write new data to it.

Example:

  • If you want to target the value of the element NAME, the path is simply: NAME

Mergado Editor reads this path and uses the value contained in the element NAME.

Note: In practice, the term “element path” is commonly used, although more precisely it always refers to the “path to the element’s value”. For simple elements, however, both terms are semantically identical.

Nested paths#

Nesting is written in the Element-Path language using the pipe character |, which expresses the parent-child relationship.

  • Syntax: To target a nested element, you add the parent’s name before it and separate them with a pipe.
  • Reading: The pipe is read as “and nested under it” or “and its child”.

Example: The path

PARAM | VAL

  • means: “Find the element PARAM and nested under it the element VAL.”
  • Important rule: The space before and after the pipe must be preservedPARAM | VAL is correct, PARAM|VAL is not.

Vocabulary and syntax of Element-Path#

Element-Path has its own “vocabulary” and syntax rules. The basic components of the language are:

  1. Element names – all names that exist in the project.
  2. Pipe (|) – denotes nesting (parent → child).
  3. Conditions ({ }) – filter values according to specified criteria.
  4. Special attributes (@@…) – allow targeting, e.g., by position (@@POSITION), value (@@VALUE), or the last value (@@MAX_POSITION).
  5. MQL (Mergado Query Language) – can be used in conditions for advanced filtering (e.g., with operators AND, OR, etc.).

Assistance when writing paths#

In Mergado Editor, working with Element-Path is facilitated by several features:

  • Autocompletion: The Editor offers available elements, operators, and values.
  • Validation: If a written element does not exist in the project, it is highlighted in red; a valid path is highlighted in green.
  • Autocompletion of shipping providers and parameters: For some feed types, the Editor offers specific names (e.g., shipping providers, parameters) and automatically completes the entire path.

Where Element-Path is used#

Element paths are used in almost all parts of Mergado Editor – wherever it is necessary to specify which data to work with.

  • In rules – e.g., Rewrite, Find and replace, Bulk copy values, Calculation. The element path determines which values the rule should work with.
  • In queries – when creating queries on the Products page or when writing a custom MQL query.
  • In variables – for reading values from specific elements and writing values to elements.
  • In imports – in the elements of import files processed via the Import data file rule.
  • On the Products page – for sorting, filtering, and viewing element values.
  • In automation – when setting up rules and conditions for automatic actions.

In practice: working with notation and conditions#

Element-Path is especially important for nested and multiple elements. Correctly writing the path determines which values Mergado reads or modifies.

1. Basic path without a condition#

If you use a nested path without a condition, Mergado targets all values in the given structure.

Example:

  • PARAM | VAL

This path refers to all VAL values across all occurrences of the element PARAM. If a product has the parameters Barva, Velikost, and Materiál, the path PARAM | PARAM_NAME leads to three values. When reading, Mergado uses the first one; when writing, the change applies to all matching values.

2. Precise targeting using conditions#

Conditions are written in curly braces { } and always bind to the element on the left. They serve to restrict targeting to specific values.

Targeting a specific value of a nested element

If you want to work only with the parameter “Barva”, use a condition that filters through the nested element PARAM_NAME:

PARAM { PARAM_NAME = “Barva” } | VAL

This notation means: “Find the element PARAM that has a child PARAM_NAME with the value Barva, and within it modify the value of the element VAL.”

This method is the safest because it works regardless of the order of parameters in the feed.

Targeting the position of a multiple element

Using the special attribute @@POSITION, you can target a value by its position. Each value has its own ordinal number (1, 2, 3 …).

Example:

  • IMAGES | IMAGE { @@POSITION = 3 }

This path targets the third image. It is suitable where the order of values has a fixed meaning. However, keep in mind that @@POSITION does not address content – if the order differs across products, an unintended value may be selected.

Targeting the value of a multiple element

The @@VALUE attribute refers to the element’s value. It is used with elements that have no children and allows targeting by a specific value regardless of its position.

Example:

CATEGORIES | CATEGORY { @@VALUE != “Hračky” }

This notation selects all CATEGORY entries whose value is not equal to “Hračky”. Conditions can also be combined with MQL operators (AND, OR, NOT, etc.), enabling very precise filtering.

Summary#

Element-Path is the fundamental language for working with data in Mergado Editor. It allows you to precisely determine where values come from, where they should be written, and in what context they are located.

A proper understanding of Element-Path structure and syntax enables you to create safe rules, effective queries, and automation that work reliably even with complex XML and CSV feeds.

FAQ#

What is the Element-Path language and what is it used for#

Element-Path is a language developed by Mergado. It is used to write paths to elements and their values – that is, to specify which data in the feed you want to work with. Using Element-Path, you can:

  • read values from the feed (e.g., for queries, calculations, or conditions),
  • write new values (e.g., using rules like Rewrite or Find and replace).

What does “element path” mean#

An element path specifies where a specific value is located in the feed’s data structure. Using the path, you tell Mergado which element the rule or query should target. Example: NAME

  • This notation says that we want to work with the value of the element NAME.

Note: Technically, it is the “path to the element’s value” because the target is always a specific value, not the element tag itself.

How is nesting written in Element-Path#

Nesting expresses the parent-child relationship and is written using the pipe character |. Syntax: PARENT | CHILD

  • Reading: “Find the element PARENT and nested under it the element CHILD.”
  • Important: The space before and after the pipe is mandatory.
    • Correct: PARAM | VAL
    • Incorrect: PARAM|VAL

Example: <PARAM> <PARAM_NAME>Barva</PARAM_NAME> <VAL>Černá</VAL> </PARAM>

The path to the value VAL is PARAM | VAL.

What is the vocabulary and syntax of Element-Path#

Element-Path has its own “grammar”. It includes these basic components:

Component Description Example
Element name Refers to a specific element in the feed. ITEM_ID
**Pipe ( )** Expresses nesting (parent → child).
Conditions ( { } ) Serve as a filter for precise targeting. `PARAM { PARAM_NAME = “Barva” }
Special attributes ( @@ ) Target by position (@@POSITION) or value (@@VALUE). IMGURL_ALTERNATIVE { @@POSITION = 2 }
MQL syntax Enables logical operations (AND, OR, NOT…) within conditions. PARAM { PARAM_NAME = “Barva” AND VAL = “Černá” }

What tools help when writing paths in Mergado#

Mergado Editor offers advanced features for working with Element-Path:

  • Autocompletion: The Editor offers available elements, attributes, and operators.
  • Validation: If an element does not exist, it is highlighted in red; valid paths are highlighted in green.
  • Autocompletion of parameters and shipping providers: The Editor automatically completes specific names and creates complete paths.

Where is Element-Path used#

Element paths are used throughout the entire Mergado Editor – wherever it is necessary to precisely specify which data you are working with.

  • In rules: e.g., Rewrite, Find and replace, Calculation, Bulk copy values.
  • In queries: in the Oneliner and in MQL queries.
  • In variables: when reading or writing values.
  • In imports: in the headers of import files.
  • On the Products page: for displaying, sorting, and filtering values.
  • In automation: when setting up rules and conditions for automatic actions.

What are conditions and how do they work#

Conditions serve as a filter that restricts which values the path should target. They are written in curly braces { } and always bind to the element to the left of them. Example: PARAM { PARAM_NAME = “Barva” } | VAL

This notation selects only the VAL values for parameters where PARAM_NAME equals “Barva”. Conditions are essential for multiple elements where the same names can repeat (e.g., different parameters for a single product).

How can MQL logical operators be used in conditions#

Element-Path supports the full vocabulary of the MQL (Mergado Query Language) language. Logical operators such as AND, OR, NOT, IN, CONTAINS, etc., can be used in conditions. Example of a complex condition: VARIANTS | VARIANT { PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE = “M” AND PARAMETERS | PARAMETER { NAME = “Materiál” } | VALUE = “Bavlna” } | STOCK | WAREHOUSES | WAREHOUSE | NAME

This notation selects the warehouse name (NAME) for variants that have size “M” and material “Bavlna”.

What special attributes does Element-Path use#

Special attributes always begin with two at signs @@ and are used in conditions. They make targeting multiple elements easier.

Attribute Description Usage example
@@POSITION Targets by value order (1, 2, 3…). `VARIANTS
@@VALUE Targets by value content. CATEGORY { @@VALUE != “Hračky” }

@@POSITION is used where the order of values corresponds to their meaning (e.g., images). @@VALUE is more reliable where the order may change.

How are conditions used with multiple nesting levels#

Conditions can also be combined across different element levels. Example of multi-level nesting: VARIANTS | VARIANT { @@POSITION = 2 } | PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE

This notation targets the value of the parameter “Velikost” for the second product variant.

What are the most common mistakes when writing paths#

  • Missing spaces around the pipe (|).
  • Incorrect placement of curly braces { }.
  • Incorrect element names (non-existent in the project).
  • Using @@POSITION for elements where the order differs between products.
  • Path ending with a parent instead of a child (e.g., PARAM instead of PARAM | VAL).

Mergado Editor automatically detects errors in the path input field – an invalid path is displayed in red.

How does Element-Path help with rule precision and safety#

Correct use of Element-Path ensures that rules, queries, and automation work only with relevant data. Thanks to a precisely defined path, you can:

  • safely read and modify values,
  • target only selected conditions,
  • prevent errors caused by changes in the feed structure.

8. Conditions in element paths#

What are conditions#

Conditions in element paths function as a filter that allows you to target only selected values and thereby refine your work with data. They are an integral part of the Element-Path language and are used especially when working with multiple and nested elements.

Conditions always bind to the element to the left of them and can only filter values of its nested children.

How conditions are written#

Conditions are written in curly braces { }, which bind to the corresponding element.

Basic notation template:

Element { Child Operator Value } | Next_child

Example:

  • PARAM { PARAM_NAME = “Barva” } | VAL

This path says: “Find the element PARAM that has a child PARAM_NAME with the value Barva, and within it target the nested element VAL.”

Notation rules#

  • Spaces are important – they cannot be omitted. This applies both inside the condition and before and after it (e.g., PARAM { PARAM_NAME = “Barva” } | VAL is correct, PARAM{PARAM_NAME=”Barva”}|VAL is incorrect).
  • Braces { } on a Czech keyboard are typed using the shortcut Alt + B (option + 9) (left) and Alt + N (option + 0) (right).
  • Conditions can contain arbitrarily complex expressions, including the operators AND, OR, NOT, or even multiple levels of nesting.

Using MQL in conditions#

Conditions in Element-Path support the full syntax of Mergado Query Language (MQL). This means you can write the same expressions as in the custom query form.

For example:

  • PARAM { PARAM_NAME = “Velikost” AND VAL = “M” }

or a more complex variant with multiple levels:

  • VARIANT { PARAMETERS | PARAM { PARAM_NAME = “Materiál” AND VAL = “Bavlna” } }

This approach allows you to combine conditions and target very precisely defined groups of values.

What conditions are used for#

Conditions refine the element path and allow you to target specific subsets of values. They are primarily used for:

  1. Targeting specific values of multiple elements.
    1. For example, when working with parameters, shipping providers, or images, where a path without a condition would lead to multiple values. The condition ensures that the rule is applied only to the correct one.
  2. Structural addition of values
    1. When writing to the feed, everything specified in a condition with the = operator or AND is created by Mergado if it does not yet exist.
    2. This allows conditions to also create new nested structures (e.g., a new parameter or flag).
  3. Using special attributes
    1. Conditions also serve for working with special attributes such as @@POSITION (value order) and @@VALUE (element value).

When they do and do not make sense#

When they make sense#

Conditions make sense for multiple elements, where one type of information can repeat multiple times.

They are most commonly used when working with:

  • parameters (PARAM),
  • shipping (DELIVERY),
  • variants (VARIANT),
  • images (IMAGE),
  • categories (CATEGORY).

Example:

  • PARAM { PARAM_NAME = “Barva” } | VAL

This notation ensures that the change is made only to the “Barva” parameter, regardless of its position in the feed. In this case, it is safer than using the @@POSITION attribute, which can differ across products.

When they do not make sense#

  1. Simple elements
    1. For simple elements (e.g., ITEM_ID, PRICE_VAT), the element always has a single value, so a condition is unnecessary.
  2. Targeting all values
    1. If you want to work with all values of an element, do not use a condition. For example: IMAGES | IMAGE
    2. This path targets all images of the given product.

In practice: filtering values using a condition#

Example path#

  • PARAM { PARAM_NAME = “Barva” } | VAL

How Mergado evaluates this path#

  1. PARAM – refers to the parent, multiple element.
  2. { PARAM_NAME = “Barva” } – is the condition that says: “We are only interested in those PARAM elements whose child PARAM_NAME has the value Barva.”
  3. | VAL – specifies that we are working with the child VAL, i.e., the specific parameter value.

The result is that Mergado selects only those VAL values that belong to the parameter named “Barva”.

Comparison with targeting by position#

The condition

  • PARAM { PARAM_NAME = “Barva” } | VAL

is more reliable than the notation

  • PARAM { @@POSITION = 2 } | VAL

Because targeting by parameter name works regardless of its order within the product. For parameters with different orders, this prevents incorrect value assignment.

Summary#

Conditions in the Element-Path language are a key tool for precise and safe targeting of specific values. They allow you to filter data, create new structures, and work with both multiple and nested elements without the risk of incorrect overwrites. Correct use of conditions helps you prevent errors, maintain order in your rules, and ensure that Mergado always modifies only the data you actually want to change.

FAQ#

What are conditions in the Element-Path language and why are they used#

Conditions are a filter that refines the element path. Using them, you specify which specific values Mergado should target – that is, which to read, modify, or create. They are mainly used with multiple and nested elements, where values repeat or share the same name. Conditions help:

  • precisely target a selected value (e.g., a specific parameter),
  • prevent errors when overwriting unrelated data,
  • create new structures directly in rules.

How are conditions written (syntax)#

Conditions are written in curly braces { }, which bind to the element standing to the left of them. Basic notation format:

  • ELEMENT { CHILD = “Value” } | NEXT_CHILD

Example:

  • PARAM { PARAM_NAME = “Barva” } | VAL

This notation says: “Find the element PARAM whose nested element PARAM_NAME has the value Barva, and within it target VAL.”

Important writing principles:

  • Spaces are mandatory – they cannot be omitted either inside the condition or before and after it.
  • Braces { } on a Czech keyboard are typed using the combination Alt + B (left) and Alt + N (right).
  • Conditions can contain multiple criteria linked by the logical operators AND, OR, NOT.

How does condition binding work in paths#

A condition always relates to the element to the left of it. Filtering is only possible through the children (nested elements) of that element. Example: VARIANT { PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE = “M” } | STOCK

This notation means: “Find the variant that has a parameter named Velikost with the value M, and within it work with the element STOCK.”

How are conditions used when working with multiple elements#

Conditions are essential when working with elements that repeat within a single product (e.g., PARAM, DELIVERY, CATEGORY, IMAGE, VARIANT). Without a condition:

  • PARAM | VAL - targets all VAL values across all parameters. When reading, Mergado uses the first value; when writing, it changes all of them.

With a condition:

  • PARAM { PARAM_NAME = “Barva” } | VAL - targets only the VAL value belonging to the “Barva” parameter. This notation is safe and unambiguous – element order does not matter.

What operators can be used in conditions#

Conditions support all common operators from the MQL (Mergado Query Language) language. This makes it possible to create even very precise and complex filters.

Operator type Example Meaning
= PARAM_NAME = “Barva” Value equality
!= @@VALUE != “Hračky” Inequality
> / < @@POSITION > 1 Numeric comparison
~ @id ~ “variant” Contains
AND PARAM_NAME = “Barva” AND VAL = “Černá” And also
OR @@VALUE = “XL” OR @@VALUE = “L” Or
NOT NOT (VAL = “M”) Negation

How is MQL syntax used in conditions#

Complete MQL queries can be written in conditions – the Mergado Query Language is fully integrated into Element-Path. This makes it possible to combine multiple filters, various nesting levels, and complex logic. Example of a complex condition: VARIANTS | VARIANT { PARAMETERS | PARAMETER { NAME = “Materiál” AND VAL = “Bavlna” } AND PARAMETERS | PARAMETER { NAME = “Velikost” AND VAL = “M” } } | PRICE

This notation selects the price (PRICE) for a variant that has the parameters Materiál = Bavlna and Velikost = M.

What if the element has no nested children#

For elements that have no nested elements, special attributes are used in conditions:

  • @@POSITION – targets by value order,
  • @@VALUE – targets by value content.

Examples:

  • IMAGES | IMAGE { @@POSITION = 3 } – the third image,
  • CATEGORY { @@VALUE != “Hračky” } – all categories except “Hračky”.

What is the difference between a condition and targeting by position#

Targeting by position (@@POSITION) only refers to the value’s order. Targeting using a condition takes content into account. Comparison:

  • PARAM { @@POSITION = 2 } | VAL – targets the second parameter in order.
  • PARAM { PARAM_NAME = “Barva” } | VAL – targets the parameter named “Barva”, regardless of its position.

Targeting by content is more reliable because it works even when the order of values differs between products.

How do conditions help when writing new data#

When writing data to the feed, the following rule applies: If a condition on an element contains only the operators = and AND with sub-elements whose values do not exist, Mergado will automatically create these values. This principle enables so-called structural addition of values – for example, adding a new parameter, variant, or flag. Example: FLAGS | FLAG { CODE = “action” } | ACTIVE

If a flag with the code action does not exist, Mergado automatically creates it and sets ACTIVE to 0.

When does it make sense to use conditions#

Conditions make sense especially with multiple or nested elements, such as:

  • PARAM or g:attribute_detail (product parameters),
  • DELIVERY (shipping),
  • VARIANT (variants),
  • IMAGE (images),
  • CATEGORY (categories).

For example, the path: PARAM { PARAM_NAME = “Barva” } | VAL

Ensures that the edit applies only to the “Barva” parameter value, not other parameters.

When do conditions not make sense#

Conditions do not make sense in these cases:

  • Simple elements – have only one value (ITEM_ID, PRICE_VAT).
  • Targeting all values – if you want to work with all occurrences of an element (e.g., IMAGES | IMAGE), there is no need to add a condition.

How to verify the correctness of a path with a condition#

In Mergado Editor, the Element Path tool is available, which allows you to:

  • test the path notation (including conditions),
  • see where the path actually leads,
  • validate whether the elements in the path exist.

In addition, the path input field offers:

  • autocompletion (elements, attributes, operators, values),
  • color-coded syntax highlighting,
  • warnings for invalid or incomplete paths.

What are the most common mistakes when writing conditions#

  • Missing spaces around curly braces { }.
  • Using a condition on an element that has no children.
  • Confusing element names (e.g., PARAM_NAME vs. NAME).
  • Missing curly braces or incorrect placement of the condition in the path.
  • Using @@POSITION instead of an element name where the order differs.

Mergado automatically alerts you to these errors by highlighting the incorrect notation.

9. Special attributes in Element-Path#

What are special attributes#

Special attributes represent an advanced tool in Mergado Editor and the Element-Path language. They are used for precise targeting with multiple elements and allow distinguishing between individual values of a given element.

Each special attribute:

  • begins with two at signs (@@),
  • binds to a specific element,
  • is used inside conditions in element paths (in curly braces { }),
  • extends the targeting and filtering capabilities of Element-Path.

The following special attributes are currently available in Mergado:

  1. @@POSITION – value position,
  2. @@VALUE – value content.
  3. @@MAX_POSITION – the number indicating the highest position of values for a given element in a specific product.

@@POSITION – targeting by position#

The @@POSITION attribute corresponds to the order of the element’s value it is bound to. It allows targeting a specific position or range of positions within a multiple element.

  • Each value has its position, expressed as a natural number (1, 2, 3 …).
  • For simple elements, the value always has position 1.
  • Only for multiple elements (IMAGE, PARAM, DELIVERY, etc.) can the position be higher than 1.

Example:

  • IMAGES | IMAGE { @@POSITION = 3 }

Read as: “Find the element IMAGES and target its child IMAGE with the value at the third position.”

Weakness: @@POSITION only works with order and does not consider the value content. If the order of values differs across products, the targeting may land on a different value than expected.

@@VALUE – targeting by value content#

The @@VALUE attribute represents the value of the element it is bound to and allows targeting based on its content. It is used in conditions for elements that have no children (or where you do not need to target a nested structure).

When to use @@VALUE

  1. For elements without children – e.g., IMGURL_ALTERNATIVE, CATEGORY.
  2. For multiple elements – allows targeting a value regardless of its position.
  3. When the order of values changes – replaces the less reliable targeting via @@POSITION.

Example:

  • CATEGORIES | CATEGORY { @@VALUE != “Hračky” }

This notation selects all categories except “Hračky”. Targeting via @@VALUE is suitable where the order of values may differ between products.

@@MAX_POSITION – helper special attribute#

The helper special attribute @@MAX_POSITION represents the position of the value with the highest order for a given element in a specific product. In other words – it designates the last position at which the given element exists within the product.

Example:

<IMAGE>www.image1.jpg</IMAGE> …@@POSITION = 1 <IMAGE>www.image2.jpg</IMAGE> …@@POSITION = 2 <IMAGE>www.image3.jpg</IMAGE> …@@POSITION = 3

In this case, @@MAX_POSITION = 3 because the highest existing position of the IMAGE element is 3. For different products, the same element may have a different @@MAX_POSITION value because the number of values can vary.

When to use @@MAX_POSITION

1. Adding new multiple values

If you want to add a new value at the end of existing values without overwriting any, use the construction: ELEMENT {@@POSITION = @@MAX_POSITION + 1}

Example:

You want to write a new image URL www.image4.jpg to the IMAGE element at the next available position.

  • Use the Rewrite rule
  • In the Element field, enter: IMAGE {@@POSITION = @@MAX_POSITION + 1}
  • In the New value field, write the new URL: www.image4.jpg

Result:

<IMAGE>www.image1.jpg</IMAGE> <IMAGE>www.image2.jpg</IMAGE> <IMAGE>www.image3.jpg</IMAGE> <IMAGE>www.image4.jpg</IMAGE>

2. Copying values to the end of an existing list

When copying values between multiple elements, you can use @@MAX_POSITION to copy “to the end” without overwriting original values.

Example:

In the feed, we have these two multiple elements:

<IMAGE>www.image1.jpg</IMAGE> …@@POSITION = 1 <IMAGE>www.image2.jpg</IMAGE> …@@POSITION = 2 <IMAGE>www.image3.jpg</IMAGE> …@@POSITION = 3

<CONTEXT_IMAGE>www.context_image1.jpg</CONTEXT_IMAGE> …@@POSITION = 1 <CONTEXT_IMAGE>www.context_image2.jpg</CONTEXT_IMAGE> …@@POSITION = 2

You want to copy all CONTEXT_IMAGE values into IMAGE without overwriting the original images.

  • Use the Bulk copy values rule
  • In the Source element field, enter: CONTEXT_IMAGE
  • In the Target element field, enter: IMAGE {@@POSITION = @@MAX_POSITION + 1}

Result:

<IMAGE>www.image1.jpg</IMAGE> <IMAGE>www.image2.jpg</IMAGE> <IMAGE>www.image3.jpg</IMAGE> <IMAGE>www.context_image1.jpg</IMAGE> <IMAGE>www.context_image2.jpg</IMAGE>

When to use which attribute#

Targeting goal @@POSITION (by position) @@VALUE (by value) Recommended approach
Images or categories (without children) Suitable if the order is fixed (e.g., 2nd image). Suitable if the order changes. Either, depending on the situation
Parameters (with nesting) Less safe – targets by order. Not suitable because the parent PARAM has no value. Safest is to target through a child (PARAM_NAME = “Barva”)

Rules for choosing:

  1. For simple elements, you do not need to specify position – it is always 1.
  2. For multiple elements without children, you can use @@POSITION or @@VALUE.
  3. For nested structures (e.g., parameters), it is safest to use a condition with the nested element name, e.g., PARAM_NAME = “Barva”.

Indexing (#)#

In addition to special attributes, Element-Path also supports indexing, which is written using the # character. Indexing = element occurrence. While @@POSITION works with the order of values inside a multiple element (e.g., the 3rd image in IMAGE), indexing with # allows you to select a specific repeated occurrence of the same element (e.g., the second “Barva” parameter), even if its order differs across products. Indexing extends targeting capabilities where @@POSITION is not sufficient.

Indexing should only be used in cases where the element path returns more than one value and the special attribute @@POSITION cannot be used because the values are at different positions for individual products.

Using indexing as a substitute for @@POSITION in situations where it is not necessary is inappropriate and can lead to performance degradation.

How to use indexing step by step#

  1. Determine which occurrence you want to target (1st, 2nd, 3rd, …) and how to identify it (e.g., a parameter named “Barva”).
  2. Open the place where you work with data – indexing can be used in queries and rules, in Element-Path fields, and also in MQL (Mergado Query Language).
  3. Add indexing to the path using # in the format: <element> #{ order }
  4. Save and apply the rule or query. Mergado will then work only with the specified occurrence.
  • Syntax: PARAM { NAME = “Barva” } #{ 2 } | VALUE
  • Meaning: Targets the second occurrence of the element PARAM | VALUE with the parameter name “Barva”.
  • Usage: Indexing is especially suitable for conditional elements where @@POSITION cannot be used.
  • Recommendation: If regular targeting by position works, @@POSITION is faster and clearer.

Example:

In the feed, we have 2 products with the parameter Barva. Both products have the parameter Barva twice with different values, at different positions.

Product A

<g:product_detail>
	<g:attribute_name>Barva</g:attribute_name>
	<g:attribute_value>Bílá</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>
<g:product_detail>
	<g:attribute_name>Materiál</g:attribute_name>
	<g:attribute_value>Keramika</g:attribute_value>
</g:product_detail>

Product B

<g:product_detail>
	<g:attribute_name>Barva</g:attribute_name>
	<g:attribute_value>Zelená</g:attribute_value>
</g:product_detail>
<g:product_detail>
	<g:attribute_name>Materiál</g:attribute_name>
	<g:attribute_value>Keramika</g:attribute_value>
</g:product_detail>
<g:product_detail>
	<g:attribute_name>Barva</g:attribute_name>
	<g:attribute_value>Červená</g:attribute_value>
</g:product_detail>

If we want to target exactly the second value of the parameter Barva for each product, we cannot use the special attribute @@POSITION because the values are at different positions. This is where Indexing helps.

The correct path notation using indexing:

  • g:product_detail { g:attribute_name = “Barva” } #{ 2 } | g:attribute_value

Tips for indexing#

  • Where to use it: in queries and rules (Element-Path, and also MQL).
  • When to use it: when you need to target a specific occurrence of the same element (e.g., “second color”) and @@POSITION is not sufficient.
  • When merging: indexing gives you control over which occurrence you are composing the resulting value from.
  • When it is not necessary: if a fixed order of values is sufficient, it is simpler and faster to use @@POSITION.

Practical examples of using special attributes#

1. Targeting a range of positions using @@POSITION#

Path for alternative images from position 3 to 8:

  • IMGURL_ALTERNATIVE { @@POSITION >= 3 AND @@POSITION <= 8 }

2. Combining position and value for targeting variants#

Path for the parameter “Velikost” in the second variant:

  • VARIANTS | VARIANT { @@POSITION = 2 } | PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE

3. Targeting an attribute using the element value @@VALUE#

Path for the attribute @value for parameters with the value “Barva”:

  • PARAM { @@VALUE = “Barva” } | @value

In this case, @@VALUE replaces the element PARAM_NAME for targeting the value “Barva”.

4. Targeting all values except one#

Path for categories except “Dětská hřiště”:

  • CATEGORIES | CATEGORY { @@VALUE NOT CONTAINS “Dětská hřiště” }

5. Indexing in queries – condition on a specific occurrence#

You want to select products where the parameter “Velikost” has a second occurrence and its value is “XL”.

Example condition (Element-Path):

  • PARAM { NAME = “Velikost” } #{ 2 } | VAL = “XL”

This notation ensures that you are evaluating exactly the second occurrence of the parameter “Velikost”, not just any “XL” value in the parameters.

Summary#

Special attributes extend the targeting capabilities of Element-Path and allow working with multiple elements at the level of individual values. @@POSITION and @@MAX_POSITION target by order, @@VALUE by content, and indexing # allows addressing specific occurrences.

Their correct use ensures that you target precise data in Mergado and perform edits safely and in a controlled manner even in complex feeds.

FAQ#

What are special attributes and why do they exist#

Special attributes are an extension tool of the Element-Path language that enables precise targeting for multiple elements. They help distinguish individual values by their order or content and are used inside conditions (in curly braces { }). Each special attribute:

  • begins with two at signs @@,
  • binds to a specific element,
  • extends targeting and filtering capabilities,
  • is never exported to the feed (unlike regular XML attributes).

Currently, Mergado supports these main special attributes:

  • @@POSITION – targeting by order,
  • @@MAX_POSITION – targeting by the highest existing position,
  • @@VALUE – targeting by value content.

What is the difference between special and regular XML attributes#

Attribute type Notation Description
Standard attribute (XML) @id, @description Is part of the XML structure and supplements the meaning of the element.
Special attribute (Element-Path) @@POSITION, @@VALUE Belongs to the Element-Path language and is used for filtering and precise targeting in conditions.

Regular XML attributes are exported to the output feed, while special attributes exist only for Mergado’s internal logic when working with rules, queries, or variables.

What does the @@POSITION attribute do and when to use it#

@@POSITION targets the order of the element’s value it relates to. Each value in the feed has its position (1, 2, 3 …), which determines its order within a multiple element. Usage:

  • Suitable for multiple elements with a fixed order (e.g., images, variants).
  • Not needed for simple elements (with a single value) – their position is always 1.

Example:

  • IMGURL_ALTERNATIVE { @@POSITION = 3 }

This notation says: “I am working with the third value of the element IMGURL_ALTERNATIVE.”

What is the weakness of @@POSITION#

@@POSITION does not work with the value content, only with its order. If the order of values differs across products, incorrect targeting may occur. Example of the problem:

  • For one product, position 2 = “Objem”,
  • for another product, position 2 = “Dekor”.

The path PARAM { @@POSITION = 2 } | VAL would then select the wrong value for the second product.

Solution: Use targeting by child name instead, e.g.,

  • PARAM { PARAM_NAME = “Objem” } | VAL

What does the @@VALUE attribute do and when to use it#

@@VALUE represents the content of the element’s value. It is used for filtering by value instead of order. Suitable usage:

  • for elements that have no children (e.g., CATEGORY, IMGURL_ALTERNATIVE),
  • for multiple elements with changing value order,
  • where you want to target by content, not by position.

Example:

  • CATEGORY { @@VALUE != “Hračky” }

This notation selects all values of the element CATEGORY except “Hračky”. Compared to @@POSITION, this method is more reliable because it works regardless of order changes.

6. How to choose between @@POSITION, @@VALUE, and a condition with a child

Targeting goal @@POSITION @@VALUE Condition with child
Images, categories (without children) ✅ If the order is fixed ✅ If the order changes
Parameters (with nesting) ⚠️ Less reliable 🚫 Not suitable – PARAM has no value ✅ Safest (PARAM_NAME = “Barva”)

Recommendations:

  • For simple elements, do not specify position.
  • For multiple elements without children, you can use both approaches (@@POSITION and @@VALUE).
  • For nested structures, always prefer targeting through the child name (e.g., PARAM_NAME).

What is indexing # and how does it differ from @@POSITION#

Indexing is a supplementary tool of the Element-Path language that allows you to precisely identify a specific occurrence of an element regardless of its order. It is written using the # character.

You can use indexing not only in Element-Path paths but also in filters and conditions in queries using MQL (Mergado Query Language). The principle remains the same – you select a specific occurrence of a repeating element.

Syntax: PARAM { NAME = “Barva” } #{ 2 }

This notation targets the second occurrence of the element PARAM named “Barva”. Options:

  • a range of positions can be specified: { 1 – 4 },
  • suitable for conditional elements where @@POSITION cannot be used.

Note: If regular targeting by position is sufficient, @@POSITION is faster and clearer.

How to combine @@POSITION and @@VALUE in a single path#

Special attributes can be combined within a single condition or with other filters using logical operators. Example 1 – targeting a range of positions: IMGURL_ALTERNATIVE { @@POSITION >= 3 AND @@POSITION <= 8 }

  • Targets alternative images from 3rd to 8th position.

Example 2 – combination with other elements: VARIANTS | VARIANT { @@POSITION = 2 } | PARAMETERS | PARAMETER { NAME = “Velikost” } | VALUE

  • Selects the parameter “Velikost” for the second variant.

Example 3 – targeting by value: CATEGORIES | CATEGORY { @@VALUE NOT CONTAINS “Dětská hřiště” }

  • Selects all categories except those containing “Dětská hřiště”.

Can I use special attributes to target element attributes as well?#

Yes. Special attributes can also be used in combination with regular XML attributes. For example: PARAM { @@VALUE = “Barva” } | @value

This notation targets the @value attribute for parameters whose value is “Barva”. Here, @@VALUE replaces the need to use the PARAM_NAME element.

What are the most common mistakes when working with special attributes#

  • Using @@POSITION for elements where the order differs across products.
  • Trying to use @@VALUE for elements that do not carry a value themselves (e.g., PARAM).
  • Confusing a single at sign @ (regular XML attribute) with two @@ (special attribute).
  • Incorrect placement of a special attribute outside a condition.

Mergado automatically alerts you to all errors in the editor with color highlighting or error messages during validation.

What is the difference between @@POSITION and @@MAX_POSITION#

Attribute Description Usage
@@POSITION Refers to a specific value position within an element. Targeting an existing value.
@@MAX_POSITION Indicates the highest position (last value) for a given element. Suitable for adding new values “to the end”.

When does it make sense to use @@MAX_POSITION#

  • When adding a new value to a multiple element so that no existing value is overwritten.
  • When copying values from one multiple element to another (e.g., images, alternative images, context images).
🇨🇿 🇬🇧 🇩🇪 🇭🇺