XQuery Add

XQuery Add is used for adding elements, attributes, HTML elements and text in the results from the input documents.

Let's understand it by using an example.

XQuery Add Example

Take an XML file named books.xml, having the following data.

books.xml

XQuery Expression

books.xqy

Now this XQuery expression will return the title elements in the same manner as they are described in the input document.

Output:

XQuery Add

Now you can add your own elements and attributes to the result.

Add HTML Elements and Text

If you want to add some HTML elements to the result, use the XQuery like this:

book.xqy:

XQuery Add2



Latest Courses