--- title: "Template" slug: "core-template-content-builder" updated: 2026-08-14T12:39:33Z published: 2026-08-14T12:39:33Z canonical: "docs.lobstersoftware.com/core-template-content-builder" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Template *See also:* [Parse XML](/v1/docs/en/core-parse-xml-value) > [!NOTE] > Value resolver – Abstract > > **Purpose:** This interprets a statically defined **Template** as a parameter, which can include the data of the print XML for the *input value* via XPath (1.0), and returns the result as a string. > > > [!TIP] > > Tooltip > > > > - **Usage**: A *Print XML* is created for the serializable object expected as an *input value*. The "Template" defined as a parameter is interpreted with its data, provided that it contains functions and XPath expressions. > > - **Parameter**: The "Template" to be applied must be entered as static text in a text field. It can combine literal characters as well as – between curly braces (`{}`) – function calls and XPath (1.0) expressions. > > - **NOTE:** The [Template](/v1/docs/en/core-template-content-builder) resolver is not available in *client context* ([Client Workflow](/v1/docs/en/frebehav-client-workflow), [Client workflows](/v1/docs/en/core-client-preferences-list-details-window-client-workflow)). ![images/download/attachments/169634416/image-2025-3-5_13-35-20-version-1-modificationdate-1741178119761-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_13-35-20-version-1-modificationdate-1741178119761-api-v2.png) --- **IMPORTANT:** The [Template](/v1/docs/en/core-template-content-builder) resolver is not available in *client context* ([Client Workflow](/v1/docs/en/frebehav-client-workflow), [Client workflows](/v1/docs/en/core-client-preferences-list-details-window-client-workflow)). --- The [Template](/v1/docs/en/core-template-content-builder) resolver interprets a static **Template** definition configured as the only parameter of the resolver, which may include references to data of the *Print XML* of the *input value* and returns an output string as a result: - Any serializable object can be used as an *input value*, either as an individual instance or a list of objects. - A list provided as an *input value* may include objects of various types. - Object data appears within the `printObjects` element of the internally generated print XML document (see example below), which can be processed by XPath (1.0) expressions from within the template. - The `printObjects` element appears in the print XML as a direct child of the root element (`<core:Print>`) after a set of elements reflecting properties of the current session: - The `<base:User>` element reflects the status of the user account ([Users](/v1/docs/en/base-user) object identified as [User of session](/v1/docs/en/base-session-user-value)) at the start time of the current session. **NOTE:** When a [Guest users](/v1/docs/en/base-guest-user) is logged in, a [Guest users](/v1/docs/en/base-guest-user) element (`<base:GuestUser>`) is inserted instead. - The `<base:CompanyAccount>` reflects the status of the company account ([Companies/Clients](/v1/docs/en/base-company-account) object identified as [Company of session](/v1/docs/en/base-session-company-account-value)) at the start time of the current session. - The `<locale>` element contains the internal key value for the [Current locale](/v1/docs/en/core-current-locale-resolver) as (inner) text. - The `<storage>` element contains all variables defined in the runtime context and their values as a list of elements with the following structure: `<entry><key>...</key><value>...</value></entry>`, where the `<key>` element defines the variable name as a `String` and the `<value>` element holds the value of the variable. An XPath expression like `/core:Print/storage/entry[key="test"]/value` therefore refers to the value of the `test` variable. **NOTE:** Unlike the other elements the `<storage>` element does not appear in a *print XML* document, which is generated interactively via ribbon command **Show print XML** (see following sample). However, in that case variable do not exist anyway. - The return value of the resolver is always of the text (string) type, unless the interpretation of the template expression combines with the object data cannot be accomplished, so "no value" (`null`) is returned. However, a real error that could be "handled" with a [Try/Catch actor](/v1/docs/en/core-try-catch-actor), for example, is not triggered. Sample content from a print XML document: For object types featured in overviews or input forms, the export ribbon features a **Show print XML** command, which produces output like the following (based on the current selection). The output presented by the neighboring ribbon command, **Show XML**, largely matches the data of the same object when featured in the `printObjects` element of a print XML document. The following example illustrates the structure of a print XML document base created for a single business object of the "Shipment" type as a `printObject`: Print XML for a shipment: ```xml        ...          ...     de                                                                          ...                                            
                                                                      sales@lobstersoftware.com                                                  ...                                                            
             
           
           ...                                                                                                                                                                    ...        
                                  ...                                       ...                           ...              
 
``` Examples for XPath expressions retrieving content from the above print XML document: | Expression | Return value | Description | | --- | --- | --- | | *Since all of the following examples share the same base path (shipment header), this part of the expression is only provided in full on the first occasion. Later examples use relative path notation with respect to the shipment header.* | | `/core:Print/printObjects/shp:Shipment` | *(complete shipment)* | *referred to as context (".") in the following examples* | | `./@id` | `305` | The "ID" (`id`) property of the shipment is an attribute (addressed with @ as prefix) in the shipment header element (`<shp:Shipment>`). | | `./attributes/shp:ShipmentCompanyAddress/value[@companyType='CNR']/@reference` | `354234653465` | A company reference ( `reference` ) attribute is retrieved from the `value` element of a company address attribute (`shp:ShipmentCompanyAddress`) for [Company type](/v1/docs/en/base-company-type) (`companyType`) "Consignor" (`'CNR'`). | | `./attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start` | `1455058800000` | The From-value (`start` attribute) of the `date` element value (`value`) of a date attribute (`shp:ShipmentDate`) of the [Date type](/v1/docs/en/base-date-type) (`dateType`) "Delivery fixed" (`'DELIVERY_FIXED'`) is returned as a long value (indicating UTC milliseconds). In practice, date/time information is often formatted as a readable text value using the `date()` function (see below). | | `./attributes/shp:ShipmentNumericValue/value[@numericValueType='GROSS_WEIGHT']/@value` | `3.2` | A plain numeric value (`value` attribute) is retrieved from a [Numeric types](/v1/docs/en/base-numeric-value-type) (`numericValueType`) "Gross weight" (`GROSS_WEIGHT`). | Including XPath expressions in a **Template**: XPath expressions and the functions described below must be enclosed in curly brackets `{}`, since strings without this marking are directly output as literals. Additionally, function names must be prefixed by a dollar sign `$` (inside the brackets). Example**:** A template to generate output in HTML format: Example template text: ```xml The following shipment was delivered:

ShipmentID{/core:Print/printObjects/shp:Shipment/@id}
Delivery date fix{$date("dd.MM.yyyy HH:mm:ss",{/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start})}

Line items
{$foreach({/core:Print/printObjects/shp:Shipment/lineItems/lineItem}) }
Packages: {@numberOfPackages} of type:{$r("typeOfPackaging",{@typeOfPackaging})}
``` HTML output with data from a specific shipment: | HTML source code | Representation in a browser document | | --- | --- | | Output ```xml The following shipment was delivered:

ShipmentID305
Delivery date fix04.02.2016 09:39:00

Line items
Packages: 3 of type:Bag
Packages: 1 of type:Box
``` | The following shipment was delivered: ShipmentID 305 Delivery date fix 04.02.2016 09:39:00 Line items Packages: 3 of type: Bag Packages: 1 of type: Box | ## Function available for processing data in "Template" expressions > [!NOTE] > **IMPORTANT:** > > In the following examples, the expressions shown have been reproduced with line breaks for the sake of clearer presentation, some of which must not occur in this way within a configuration. Copying and pasting such expressions into a specific configuration is therefore not recommended, since errors or unexpected results may occur. | Function | Syntax/Details | Example | | --- | --- | --- | | **date()** Date formatting | `{$date(datePattern,dateValue[;Timezone])}` | | The *datePattern* uses the syntax for the java class **SimpleDateFormat**, as specified in detail at the following link: [https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) Pattern may be enclosed in total by double quotes (`""`). This enables the use of certain characters such as `()` or , as part of the pattern, which otherwise will provoke parsing issues. Literal strings within a pattern can be "commented out" by single quotes. This may be necessary because plain letters are either representing date components (see mapping below) or not accepted at all. Example: `{$date("h'h 'mm'm'",{timestamp})}` creates output like: "7h 05m" **IMPORTANT:** Notation rules applicable for `datePatterns` explained in this context, are not identical with mappings for date functions in other contexts. Since the characters and their mappings do overlap in part, it is especially important to understand and respect the specifics of mapping and rules precisely and per context when designing patterns. The following table is provided as quick reference and does not feature full details: \| Component \| Description \| Output values \| \| --- \| --- \| --- \| \| G \| Era (BC/AD) \| AD, BC \| \| yy, y or YY, Y \| Year \| 21, 2021 \| \| M, MM, MMM, MMMML, LL, LLL, LLLL \| Month (digits or text) \| 1-12, 01-12, Jan-Dec, January-December \| \| D, DDD \| Day of the year (digits) \| 1-366 or 001-366 \| \| d, dd \| Day of the month (digits) \| 1-31, 01-31 \| \| w, ww \| Calendar week (digits) \| 1-53, 01-53 \| \| W \| Week of the month (digits) \| 1-5 \| \| u, E \| Day of the week (digit or text) \| 1-7, Mon-Sun, Monday-Sunday \| \| F \| Day of the week in month (digit) \| 3 (as in: "3rd Monday in May") \| \| H, HHk, kkh, hh (a)K, KK (a) \| Hour of the day \| 0-23, 00-231-24, 01-241-12, 01-12 (AM/PM)0-11, 00-11 (AM/PM) \| \| m, mm \| Minute in the hour \| 0-59, 00-59 \| \| s, ss \| Second in the minute \| 0-59, 00-59 \| \| S, SSS \| Milliseconds in the second \| 0-999, 000-999 \| \| z, Z, X \| Time zone (var.) \| Europe/Berlin, -0200, -02 \| | Example**:** Indicate value of date attribute `DELIVERY_FIXED` in default system time zone: ```Custom {$date("dd.MM.yyyy HH:mm:ss (z)",{/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start} )} ``` **Result:** "04.02.2020 09:39:00 (Europe/Berlin)", provided default system time zone is "Europe/Berlin" date attribute exists. **NOTE:** If the date attribute addressed by XPath is not found in the print XML of the shipment, the expression fails and the resolver returns "no value" (`null`). Using the `with()` function (see following example), may help to handle this case in an elegant way. --- Example**:** Indicate value of the date attribute `DELIVERY_FIXED` in the time zone stored in the attribute: ```Custom {$with(/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED"]/date) {$date("dd.MM.yyyy HH:mm:ss"),{@start};{@timeZone})} } ``` - To access both fields "From" (`start`) and "Timezone" (`timeZone`) within the same date attribute (`DELIVERY_FIXED`), the `date()` function is executed here within a `with()` function (see below), which defines a common point of reference (`<date>` element of the date attribute) within the print XML as a context for both `date()` function calls. **Result:** "04.02.2020 07:39:00 (UTC)", provided the date attribute refers to time zone "UTC". **NOTE:** - If the date attribute provides no indication for the time zone, the resolver will return no result overall. This will also occur if the expression refers to one of the date properties "from" (`start`) or "to" (`end`) when there is no value for that property. Since this is not uncommon, at least if business objects are created by import, such cases should be handled with logical functions like `if()` and `cmp()` as demonstrated in later examples of this section. - If the date attribute is completely non-existent (in the print XML) no special handling is necessary, as in this case the `with()` function will not resolve any context and therefore skip the interpretation of the expression including the `date()` function calls. --- Example**:** Indicate value of date attribute "DELIVERY_FIXED" in the default time zone of [User of session](/v1/docs/en/base-session-user-value): ```Custom {$date("dd.MM.yyyy HH:mm:ss (z)",{/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start};{/core:Print/base:User/@defaultTimeZone} )} ``` - The print XML contains the user and company account of the session (as explained above). Therefore, the property "Default time zone" (`defaultTimeZone`) can be looked up by an XPath expression in the respective child element. **Result:** "03.02.2020 21:39:00 (Pacific/Honolulu)", if the default time zone for the current user account is "Pacific/Honolulu". **NOTE:** If no default time zone is specified in the account of the current user, the resolver returns "no value" overall. This case can be handled with functions` if()` and `cmp()`, as required. A solution might look as follow: ```Custom {$date("dd.MM.yyyy HH:mm:ss (z)",{/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start}; {$if ({$cmp({/core:Print/base:User/@defaultTimeZone},!=,)}){then {/core:Print/base:User/@defaultTimeZone}}{else UTC}} )} ``` - Time zone "UTC" is provided as a fallback here, in case no indication for default time zone is found. | | Component | Description | Output values | | G | Era (BC/AD) | AD, BC | | yy, y or YY, Y | Year | 21, 2021 | | M, MM, MMM, MMMML, LL, LLL, LLLL | Month (digits or text) | 1-12, 01-12, Jan-Dec, January-December | | D, DDD | Day of the year (digits) | 1-366 or 001-366 | | d, dd | Day of the month (digits) | 1-31, 01-31 | | w, ww | Calendar week (digits) | 1-53, 01-53 | | W | Week of the month (digits) | 1-5 | | u, E | Day of the week (digit or text) | 1-7, Mon-Sun, Monday-Sunday | | F | Day of the week in month (digit) | 3 (as in: "3rd Monday in May") | | H, HHk, kkh, hh (a)K, KK (a) | Hour of the day | 0-23, 00-231-24, 01-241-12, 01-12 (AM/PM)0-11, 00-11 (AM/PM) | | m, mm | Minute in the hour | 0-59, 00-59 | | s, ss | Second in the minute | 0-59, 00-59 | | S, SSS | Milliseconds in the second | 0-999, 000-999 | | z, Z, X | Time zone (var.) | Europe/Berlin, -0200, -02 | | **fn()** Format number | `{$fn(Number[,precision=2[,integerDigits=1[,thousandsSeparator=false]]])}` | | This function creates a formatted `String` from a numerical value that must be provided or a `String` that can be interpreted as a numerical value. The following parameters can be optionally specified to control formatting details: \| Parameter \| Default value \| Effect \| \| --- \| --- \| --- \| \| `precision` \| 2 \| Number of decimal places output (incl. rounding). \| \| `integerDigits` \| 1 \| Minimum number of integer digits. \| \| `thousandsSeparator` \| false \| Group integer digits into groups of three with separators? \| **NOTE:** The localizations applicable to the [Current locale](/v1/docs/en/core-current-locale-resolver) for the language management entries `lobsterui/decimalSeparator` and `lobsterui/thousandsSeparator` are used as decimal and thousands separators. | Example: A variable `mtom` in the data context contains a "Unit number" (`UnitNumber`), which is to be output with a reference to the unit and exactly 3 decimal places. ```Custom {$date("dd.MM.yyyy HH:mm:ss (z)",{/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DELIVERY_FIXED']/date/@start} )} ``` **Result:** *(Sample data)* `max. take-off mass [t]: 10,423` **NOTE:** The unit can only be labelled here via the "alias" (see [Units](/v1/docs/en/core-unit)), which the XML structure for the `UnitNumber` contains directly. In contrast, the "name" (`name`) of the associated dynamic enumeration value (e.g. `TON`) or the applicable localization (e.g. "tonne") is used in the *string image* of a `UnitNumber` to map the unit. In the context of the [Template](/v1/docs/en/core-template-content-builder) value resolver, there is no direct way to obtain this localization based on the "Alias" `String`. --- Example**:** All IDs and names of the attributes that belong to the "address" (`address`) of the logged-in user should be listed. The IDs should be mapped as an exact six-digit integer (with ‘leading zeros’ if necessary) and thousands separators. ```Custom {$foreach({/core:Print/base:User/address/attributes/*}) #{$fn({@id},0,6,true)} - {name()} } ``` **Result**: *(Sample data)* `#016.153 - base:AddressCommunicationInfo` `#016.154 - base:AddressCommunicationInfo` `#010.051 - base:AddressContact` `#010.052 - base:AddressContact` `#011.601 - base:AddressLinkedEntity` `#016.251 - base:AddressFlag` | | Parameter | Default value | Effect | | `precision` | 2 | Number of decimal places output (incl. rounding). | | `integerDigits` | 1 | Minimum number of integer digits. | | `thousandsSeparator` | false | Group integer digits into groups of three with separators? | | **r()** *(resource)* Localization | `$r(ResourceBundle,ResourceName)` | | This function resolves a localization text from [Localization](/v1/docs/en/core-localization-entry) for a given combination of *Resource Bundle* and *Resource Name*. The optional `prepareValue` parameter (default value: `true`) can be used to switch off (`false`) escape substitutions (e.g. for ZPL print commands). The following optional parameters (param0, param1, ...) can be used to provide values for the corresponding placeholders (`{0}`, `{1}`, ...) in localization texts. **NOTE:** Unlike other [Localization](/v1/docs/en/core-localization-entry) access methods, the `r()` function does not provide a definition for a default value that would be assigned as a return value if no entry exists for the given combination of *Resource Bundle* and *Resource Name*. | Example**:** Apply a label for a date value according to the localization for the given [Date type](/v1/docs/en/base-date-type) ```Custom {$with ({/core:Print/printObjects/shp:Shipment/attributes/shp:ShipmentDate/value[@dateType='DISPATCH_DATE']}) {$r(de.lobster.scm.base.bto.attribute.DateType,{@dateType})}: {$date(y-MM-dd,{date/@start})}} ``` **Result:** "Dispatch date: 2020-02-19" - This `r()` function call refers to the common resource bundle for all date types to look-up the date type (`dateType`) specified in the date attribute. - --- Example: Highlighting a value via formatting defined as a localization entry value. `{$r(textModules,highlight,,{/core:Print/base:User/address/@name1})}` **Result**: "►Karola◄" ... if the (first) name for the [User of session](/v1/docs/en/base-session-user-value) is "Karola" and there is an entry for [`textModules,highlight`]in the localization that returns the localization text "`►{0}◄`". | | **with()** XPath context | `{$with({XPathExpression})TemplateExpression}` | | The with() function resolves an `XPathExpression` to define a specific element in the print XML as a point of reference for the interpretation of any relative path found within the `TemplateExpression` of the `with()` function. Effectively, a "base path" common to several XPath expressions will only be featured once within the bracketed header clause "( )", making the `TemplateExpression` shorter and more transparent. Besides, the use of relative paths in the `TemplateExpression` will improve the chances of being able to cut & paste content to a different context without adaptations. Relative paths in XPath expressions may refer to parent levels "above" the original level provided by the `with()` function (e.g. by "../"). Besides, it is always possible to refer to any other element within the print XML from within a `TemplateExpression` using absolute paths. The `TemplateExpression` may contain more or less complex expressions, to include further calls of the `with()` function, which temporarily define a new "nested" context. **NOTE:** If the `XPathExpression` returns more than one element, only the first "match" will be used as a context for processing the `TemplateExpression`*.* To loop over all nodes returned by an XPath expression, refer to the `forEach()` function (see below), instead of `with()`. | Example**:** Structured output of address data from a company account ```Custom {$with ({/core:Print/printObjects/base:CompanyAccount/address}) #{@accNumber} (ID {../@id}) {@name1} {@name2} {@name3} {@street1} {@streetNo} {@zipcode} {@city} {$r(de.lobster.scm.localization.Country,{@countryCode})} } ``` - The `address` element of the company account serves as a common context here, as it contains most of the relevant properties (*in XML: attributes*). - The internal id (`id`) of the company account is read from a property from the parent level of the address by a relative path (`../@id`). - A `r()` function (see above) call resolves the localized plain text for the "Country" identified by the country code from the address (`countryCode`). **Result:** Presentation of the string returned by the resolver in a pop-up of the "Info" type:![images/download/attachments/169634416/image2020-3-6_17-26-52-version-1-modificationdate-1710864213806-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-3-6_17-26-52-version-1-modificationdate-1710864213806-api-v2.png) --- Example**:** Similar presentation of address data from the company attributes ([Company type](/v1/docs/en/base-company-type) AAL and CNE) of an order: ```Custom {$with ({/core:Print/printObjects/ord:Order/attributes/ord:OrderCompanyAddress/value[@companyType='AAL']/company/address}) {$r(de.lobster.scm.base.company.CompanyType,{../../@companyType})} ------------------------------------- #{@accNumber} (ID {../@id}) {@name1} {@name2} {@name3} {@street1} {@streetNo} {@zipcode} {@city} {$r(de.lobster.scm.localization.Country,{@countryCode})} } {$with ({/core:Print/printObjects/ord:Order/attributes/ord:OrderCompanyAddress/value[@companyType='CNE']/company/address}) {$r(de.lobster.scm.base.company.CompanyType,{../../@companyType})} ------------------------------------- #{@accNumber} (ID {../@id}) {@name1} {@name2} {@name3} {@street1} {@streetNo} {@zipcode} {@city} {$r(de.lobster.scm.localization.Country,{@countryCode})} } ``` - To identify the type of content, the headline of each address section features the localized text of the respective [Company type](/v1/docs/en/base-company-type). The entire `TemplateExpression` can be copied and pasted without any change into a new with() instance, to present another company address using the same format. In the given example, addresses for the company types "Principal" (AAL) and "Consignee" (CNE) are explicitly concatenated in this sequence in the expression. A list of all involved companies can be created much more efficiently by using the `forEach()` function (see example below). However, retrieving all addresses in a loop allows no control over the sequence of company types. **Result:** ![images/download/attachments/169634416/image2020-3-9_12-38-49-version-1-modificationdate-1710864213810-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-3-9_12-38-49-version-1-modificationdate-1710864213810-api-v2.png) | | **forEach()** Loop over XPath elements | `{$foreach({XPathExpression}) TemplateExpression}` | | The `TemplateExpression` is interpreted in a loop over all elements (if any) returned by `XPathExpression`. Each iteration of this loop uses another instance from a list of nodes returned by `XPathExpression` as a context for interpreting any *relative* XPath expressions found in the `TemplateExpression`*.* The `TemplateExpression` may contain more or less complex expressions, to include further calls of the `forEach()` function, which temporarily define a new 'nested' context and set of elements to iterate (see the final example on the right). | Example**:** Following the outlines of the examples for the `with()` function (see above), the given address section layout should be used to create a list featuring all companies involved. ```Custom {$foreach ({/core:Print/printObjects/ord:Order/attributes/ord:OrderCompanyAddress/value/company/address}) {$r(de.lobster.scm.base.company.CompanyType,{../../@companyType})} ------------------------------------- #{@accNumber} (ID {../@id}) {@name1} {@name2} {@name3} {@street1} {@streetNo} {@zipcode} {@city} {$r(de.lobster.scm.localization.Country,{@countryCode})} } ``` **Result:** A list of company addresses, as in the previous example, but listing addresses for more company types (if any). --- Example**:** Creating HTML content to define the involvement of the current company with an order by a list of [Company type](/v1/docs/en/base-company-type). ```xml {$foreach ({/core:Print/printObjects/ord:Order/attributes/ ord:OrderCompanyAddress/value[company/@id=/core:Print/base:CompanyAccount/@id]}) }
{@companyType} {$r(de.lobster.scm.base.company.CompanyType,{@companyType})}
``` - Each row (`tr`) of the table features two columns, populated with the internal key value and the localization of the company type. **Result:** (based on an different order from the one used in the examples for the `with()` function). \| Return value of the resolver \| Presentation in a browser \| \| --- \| --- \| \| ```xml
INVBill to party
AALPrincipal
``` \| *using CSS*-Style `table,td {border:1px solid black}` ![images/download/attachments/169634416/image2020-3-9_13-58-4-version-1-modificationdate-1710864213813-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-3-9_13-58-4-version-1-modificationdate-1710864213813-api-v2.png) \| --- Example**:** As an abstract from the data of an order an HTML list of all addressed contained should be generated, featuring selected address properties as list items (as far as provided). ```Custom {$with({/core:Print/printObjects}) {$foreach({.//address\|.//contactAddress})

ADDRESS # {@id}

} } ``` - The `with()` function call defines the `printObjects` element as the context for the `forEach()` loops, to ensure that addresses belonging to the session context (`/core:Print/base:User` and `/core:Print/base:CompanyAccount`) do not appear in the list. - The outer f`orEach()` loop iterates over all `address` and `contactAddress` elements contained in the order and creates one HTML paragraph (`<p>`) for each address, which identifies this addess by its internal ID (`id`) followed before the list element (`<ul>`) is initiated. - The address properties are retrieved by a nested `forEach()` loop, iterating over all attributes (@*) of an `address` element specified by the iteration of the parent loop, if they match criteria defined in a rather complex predicate expression (`[...]`). This predicate demonstrates various techniques of specifying a selection of properties by attribute name. From a functional point of view, attributes are accepted, if their name begins with `name` or `street` or is found in a list {`zipcode, city, countryCode`}. Effectively, this rules applies for `address` properties `name1, name2, name3, street1, street2, streetNo, countryCode, zipcode, city`. For each of these properties populated within an address, a list item (`<li>`) featuring the attribute value (`{.}`) as text is added to the list (`<ul>`). **Result:** (clipped from a larger list) \| Return value of the resolver \| Display in browser \| \| --- \| --- \| \| ```xml

ADDRESS # 7652

ADDRESS # 3715

ADDRESS # 3716

ADDRESS # 4952