How to declare the Concat function in XML using XQuery

In this article we will discuss about how to declare and use the XQuery function in XML.
  • 2568

This is one of the most important built-in-function in XQuery. This function concatenate two or more strings together means it is use to combine the two or more strings. This function must take at least two argument and further can take two or more argument but not less than two.

The syntax to declare the concat function in XQuery is as folows:

fn:concat ($string as xs:string?,$string as xs:string?[, ...]) as xs:string

Here fn is the prefix to the concat function and $string as xs:string is the name of the argument passed to it and as xs:string is return type of this function.

Here is the example to explain it.

XQuery Concat Function Example  Output
concat('x' , 'y') xy
concat('x','y','z') xyz
concat('x', ( ) ,' y' , ' ', 'z') xyz
concat( ('x','y','z') ) Error XPST0017
concat( 'x' , <a>y</a> , 'z') xyz

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2019 DotNetHeaven. All rights reserved.