The concat() function

Smartsite 7.4 - ...

The contains() XPath 2.0 function returns the concatenation of the string values of the arguments.

XML CopyCode image Copy Code
string fn:concat(arg1, arg2, ...)

Parameters:

  • arg1: a node reference or string literal.
  • arg2: a node reference or string literal.
  • one or more arguments ... (optional), each of them a node reference or string literal.

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:fn="http://www.w3.org/2005/xpath-functions">
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
    <data xmlns="">
     <tekst1>aa</tekst1>
     <tekst2>bb</tekst2>
     <tekst3>cc</tekst3>
    </data>
   </xf:instance>
  </xf:model>
 </head>
 <body>
  <xf:group>
   <xf:output value="fn:concat('aa', ' ', 'bb', ' ', 'cc')" />
   <xf:output value="fn:concat(tekst1, ' ', tekst2, ' ', tekst3)" />
  </xf:group>
 </body>
</html>

The result will be:

aa bb cc
aa bb cc

Namespace

This function is available within the XPath 2.0 namespace (http://www.w3.org/2005/xpath-functions).