I have the following xml content:
<ns2:ItemAttributes xml:lang="de-DE">
<ns2:Creator Role="Role1">Creator One</ns2:Creator>
<ns2:Creator Role="Role2">Creator Two</ns2:Creator>
<ns2:Creator Role="Role3">Creator Three</ns2:Creator>
</ns2:ItemAttributes>
I am trying to format and merge this into one line using xpath. Sort of:
string-join(//ns2:Creator/concat(./text(), @Role), ', ')
I think I'm somewhere nearby, because this:
string-join(//ns2:Creator/@Role , ', ')
works and provides a comma separated list of roles: Role1, Role2, Role3
and this one
string-join(//ns2:Creator/node(), ', ')
unites the values of the creators: "One Creator, Two Creator, Three Creator."
I need a final conclusion
Role1: Creator One, Role2: Creator Two, Role3: Creator Three
Could you help me.
source
share