Computed comment constructors

A computed comment constructor creates a comment node for which the content of the node is computed based on an enclosed expression.

The result of a computed comment constructor is a new comment node that has its own node identity.

Syntax

Read syntax diagramSkip visual syntax diagramcomment{CommentContents}
comment
A keyword that indicates that a comment node will be constructed.
CommentContents
An expression that generates the content of the comment. During processing, atomization is applied to the result of CommentContents, and each atomic value in the atomized sequence is cast to a string. The individual strings that result from the cast are concatenated with an intervening space character. If atomization results in an empty sequence, the sequence is replaced by a zero-length string. The content sequence cannot contain two adjacent hyphens or end with a hyphen.

Example

The following computed constructor creates the comment <!--Houston, we have a problem.-->:

let $homebase := "Houston"
return comment {fn:concat($homebase, ", we have a problem.")}