Home >>XQuery Tutorial >XQuery concat() Function

XQuery concat() Function

XQuery concat() Function

The method XQuery concat is used for the concatenation of various strings.

concat($input as xs:anyAtomicType?) as xs:string

Parameter explanation:

$input - It is used to specifies one or more inputs separated by comma.

XQuery concat Example

Let's take an illustration to show you how XQuery concat feature is used. Take an XQuery expression, named "books.xqy," with the code below. It will concat the title and price of the provided expression XQuery.

XQuery Expression: books.xqy:


let $bookTitle := "Learn XQuery in 24 hours"  
let $updatedTitle := concat($bookTitle,",price: 200$")  
return  
<result>     
<title>{$updatedTitle}</title>  
</result>  

To read the books.xqy, build a Java-based XQuery executor application, transfer it over to the XQuery expression processor, and execute the expression. After that it shows the output.


No Sidebar ads