Using concat in xpath to node that occurs more than once

Options
reactancexl
reactancexl Posts: 195 ✭

I need to prepend and append brackets [] to my xpath result in a JSON databank. Below is what I am trying to do but it errors as the occurrence is more than once. The result I would like would look like this [434389]. I would take this result and put in writable. What is best way to handle this?

concat("[",/root/results/item/id/text(),"]")

Tagged:

Best Answer

  • benken_parasoft
    benken_parasoft Posts: 1,392 ✭✭✭
    Answer ✓
    Options

    How about this?

    for $item in (/root/results/item/id/text())
    return concat("[", $item, "]")
    

Answers

Tagged