Text node constructors
All text node constructors are computed constructors. A text node constructor creates a text node for which the content of the node is computed based on an enclosed expression.
The result of a text node constructor is a new text node that has its own node identity.
Syntax
- text
- A keyword that indicates that a text node will be constructed.
- ContentExpression
- An expression that generates the content of the constructed text node. During processing, atomization is applied to the result of ContentExpression, and each atomic value in the resulting sequence is cast to a string. The individual strings that result from the cast are concatenated with an intervening space character. The concatenated string becomes the content of the constructed text node. If atomization results in an empty sequence, no text node is constructed.
Note: A text node constructor can be used to construct a
text node that contains a zero-length string. However, if this text node is
used in the content of a constructed element or a document node, then the
text node is deleted or merged with another text node.
Example
The following constructor creates a text
node that contains the string "Hello":
text {"Hello"}