Ben Aston
Ben Aston

Reputation: 55759

Text nodes in XQuery

Creating a text node in XQuery is done like so

text { 'foo' }

Can someone explain the syntax here? Is a function being invoked? If so, I would expect to see text('foo').

Upvotes: 0

Views: 179

Answers (1)

Will Goring
Will Goring

Reputation: 1040

That's a computed constructor; XQuery syntax for creating nodes. The same syntax works for creating (for example) elements and attributes:

element hello {
  attribute target { "world" }
}

See The XQuery spec for full details.

Upvotes: 1

Related Questions