Skip to content

Element <property>

Purpose: Scoped property override for one included XML descriptor.

Why: Use it to pass one scoped literal or evaluated override into an included descriptor.

Example

1
<property name="scheme" constant="test"/>

Decision guide

Business value: Lets a caller configure one include without changing or duplicating the included fragment.

  • Use when

    • Passing a literal or computed value into an included XML fragment.
  • Choose another approach when

    • Declaring the fragment's accepted interface or changing global runtime configuration.
  • Prerequisites

    • Place it inside include and match a param name expected by the fragment.
  • Alternatives

    • Use param inside the fragment to declare the accepted input. (See: <param>)

Complete examples

Call one typed descriptor fragment with scoped parameters

Use a param contract and include-local properties when several business products share one model shape but require different bounded values.

parameterized-fragment/fragments/payment.xml
1
2
3
4
5
6
7
8
9
<setup>
    <param name="entity_name" description="Product emitted by this fragment."/>
    <param name="scheme" type="enum" values="SEPA SWIFT"/>
    <param name="count" type="int" default="2"/>
    <generate name="{entity_name}" count="{count}" target="LogExporter">
        <id name="id" generator="IncrementGenerator"/>
        <key name="scheme" constant="{scheme}"/>
    </generate>
</setup>
parameterized-fragment/datamimic.xml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<setup>
    <include uri="fragments/payment.xml">
        <property name="entity_name" constant="sepa_payments"/>
        <property name="scheme" constant="SEPA"/>
        <property name="count" constant="3"/>
    </include>
    <include uri="fragments/payment.xml">
        <property name="entity_name" constant="swift_payments"/>
        <property name="scheme" constant="SWIFT"/>
    </include>
</setup>

Rules and invalid combinations

A property requires constant or script.

Attributes: constant, script

Why: The include must receive either a literal value or a caller-context expression to evaluate.

Valid combination
1
<property name="channel" constant="WEB"/>
Invalid combination
1
<property name="channel"/>
Choose constant or script, never both.

Attributes: constant, script

Why: Literal and evaluated values have different validation timing and cannot jointly own one property.

Valid combination
1
<property name="channel" script="requested_channel"/>
Invalid combination
1
<property name="channel" constant="WEB" script="requested_channel"/>
constant rejects expression braces.

Attributes: constant, script

Why: Use script for caller-context evaluation; constant is deliberately parse-time literal.

Valid combination
1
<property name="channel" constant="WEB"/>
Invalid combination
1
<property name="channel" constant="{requested_channel}"/>

Allowed parents / Allowed children

Allowed parents: else, else-if, if, include, while

Allowed children:

None

  • Dynamic Includes and Fragment Parameters — Explains URI interpolation, scoped include properties, typed fragment params, runtime caller context, nesting, conditions, and cataloged failures for reusable XML composition.

Attributes

Show all 3 attributes

constant

Literal value injected into the child include scope. {expr} is forbidden.

optional; string; Default: null.

name

Property key injected into the included descriptor scope.

required; string.

script

Expression evaluated in the direct caller context when the include executes.

optional; string; Default: null.