9

for the below data -

let $x := "Yahooooo !!!! Select one number - "
let $y := 
<A>
  <a>1</a>
  <a>2</a>
  <a>3</a>
  <a>4</a>
  <a>5</a>
  <a>6</a>
  <a>7</a>
</A>

I want to get the output as -

`Yahooooo !!!! Select one number - [1 or 2 or 3 or 4 or 5 or 6 or 7]`
John
  • 2,820
  • 3
  • 30
  • 50

1 Answers1

14

In XQuery 3.0, you can use || as a string concatenation operator:

return $x || "[" || fn:string-join($y/a, " or ") || "]"

In XQuery 1.0, you need to use fn:concat():

return fn:concat($x, fn:concat("[", fn:concat(fn:string-join($y/a, " or "), "]")))
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
joemfb
  • 3,056
  • 20
  • 19