Tamino XML Server Version 9.7
 —  XQuery 4 Reference Guide  —

ComputedAttributeConstructor

Construct an attribute by computing an expression.


Syntax

ComputedAttributeConstructor

graphics/ComputedAttributeConstructor.png

QName Expr ExprSequence

Top of page

Description

A ComputedAttributeConstructor constructs an attribute by computing the enclosed ExprSequence, called content expression. The name of the attribute is either a QName or it is computed from an expression (name expression).

The value resulting from evaluating the name expression undergoes atomization, and must be a single atomic value of the type xs:QName, xs:string, or xdt:untypedAtomic, otherwise a type error is raised. If it is of type xs:QName, its expanded QName is used as element name and the prefix part of the QName is retained. Otherwise, the value is converted to an expanded QName. If a namespace prefix is present, it is resolved using the statically known namespaces, otherwise it is local in the default namespace.

The content expression is evaluated and, after atomization, converted into a sequence of atomic values each of which is cast into a string and concatenated with a space character between each pair of values. If the result of the expression after atomization is an empty sequence, the string is of length zero.

Tip:
A computed attribute constructor is needed in the context of update expressions, since you cannot construct a stand-alone attribute with the constructors using regular XML syntax.

Top of page

Example

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:

Top of page