xmerge: reuse the value of value.indexOf and remove duplicated code

Change-Id: I44d72f7d9f8c58436657ea1517d8eb76332abb4b
Reviewed-on: https://gerrit.libreoffice.org/11747
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>