I'm using Editix to run some XML queries, and I'm trying to get the "role" attribute from the tags...
<actor id="5" role="Richie Cusack"/>
....and insert the value in between tags that I generate, like so....
<role>Richie Cusack</role>
...but the query I'm running is inserting the role attribute value back into an attribute of the tags I surround it with, like...
<role role="Richie Cusack"/>
Here's my XQuery query....
<results>
{
let $ms := doc("xmlPath.xml"),
for $m in $ms//movie
for $r in $m/actor/@role
return <result>
{$m/title}<role>{$r}</role>
</result>
}
</results>
...and here's the structure of the XML file...
<movies>
<movie>
<title>A History of Violence</title>
<year>2005</year>
<country>USA</country>
<genre>Crime</genre>
<summary>Tom Stall, a humble family man and owner of a
.</summary>
<director id="1"/>
<actor id="5" role="Richie Cusack"/>
</movie>
<movie>
<title>Heat</title>
<year>1995</year>
<country>USA</country>
<genre>Crime</genre>
<summary>Hunters and their prey--Neil and his professional
.... </summary>
<director id="6"/>
<actor id="7" role="Lt. Vincent Hanna"/>
</movies>
How can I extract only the value of an attribute and embed it in between tags without it inserting itself in the form of an attribute?