user1610952
user1610952

Reputation: 1289

Replace a certain string of xml node using Xquery

I'd like to replace "~" of element with the value of element using xquery (Update facility). Is this possible?

Sample.xml

<entry>
<keyword>ace</keyword>
<example>~ card</example>
</entry>

Result.xml

<entry>
<keyword>ace</keyword>
<example>ace card</example>
</entry>

Upvotes: 0

Views: 1990

Answers (1)

Jayy
Jayy

Reputation: 2436

Below Xquery will modify the node value.

for $i in /entry
  return replace($i/example, '~', $i/keyword);

Now, if you want to update the node with this value, you should let us know with which engine you are running the Xquery.

Upvotes: 1

Related Questions