Is there a way of getting an element name in XQuery?
I want to take an element name and use it as the value of an attribute.
For example to convert
Smith
to
Smith
Hello
There is a way of getting the element Tag name with an XQuery using the function “local-name” with input of the node.
For example (in your case with node:surname):
** Attention this updates your DB
update
for $x in input()/surname
do
insert attribute label {local-name($x)}
into $x
For testing reasons it is better to use **
for $x in input()/surname
return
{attribute label {local-name($x)}}
{$x/@*}
{$x/node()}
kind regards
Thanks Scholz - that was the answer I was looking for.
Kind regards,
David Sanders