I have an input field coming as
<BID>12-ABS-65789345</BID>
I need to adjust the XQuery such way that, I need to capture only last part of the field like after two - symbols.
In above case, I need the output of XQuery as below
<BID>65789345</BID>
Any help here..
Thanks
Assuming your requirement can be interpreted as taking the content after the "last" hyphen, you can take the last item in the sequence formed by splitting the string on hyphen:
let $x := <BID>12-ABS-65789345</BID>
return
<BID>{tokenize($x,'-')[last()]}</BID>
If you always need the content after the second hyphen and you can guarantee there will always be at least two hyphens then you can take the third item after splitting the string:
let $x := <BID>12-ABS-65789345</BID>
return
<BID>{tokenize($x,'-')[3]}</BID>