Skip to content

attribute

attribute(element, name) → string · XML

Get a specific attribute value from an XML element by name. Useful when the attribute name is dynamic (stored in a variable). For static attribute access, prefer the @ operator: $input.@id.

  • element (required): XML UDM element

  • name (required): attribute name (string)

utlx
// Input: <Order id="ORD-123" status="active">...</Order>
// See Chapter 22 for XML attribute access (@ operator).

// Preferred: use @ for known attribute names
{
  orderId: $input.@id,                  // "ORD-123"
  status: $input.@status                // "active"
}

// Use attribute() when the name is dynamic (e.g. from input data)
{
  value: attribute($input, $input.lookupField)   // attribute name from data
}

Released under AGPL-3.0.