CompPIConstructor

Construct a processing instruction by computing an expression.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

CompPIConstructor

graphics/CompPIConstructor.png

NCName Expr Expr

Description

A CompPIConstructor constructs a processing instruction (PI) by computing the enclosed Expr, called content expression. The name of the element is either a NCName 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:NCName, xs:string, or xdt:untypedAtomic, otherwise a type error is raised. If necessary, the value is cast into type xs:NCName. It is then used as the PI target.

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, it is replaced by a string of length zero.

Example

  • This constructs the processing instruction <?audio-output beep?> :

    let $target := "audio-output",
        $content := "beep" 
    return processing-instruction {$target} {$content}