Is there anyway in xquery to do like in sql: "SELECT name AS buyer"?
enter code here
let $stars := doc("stars.xml")
for $s in $stars/Stars/star
where $s/Address/Street eq "123 Maple St."
return $s/(Name **AS buyer** |cost)
output something like:
<Buyers>
<buyer name=”Ash”><cost>40</cost></buyer>
...
</Buyers>
CodePudding user response:
Instead of return $s/(Name **AS buyer** |cost)
, I think you want e.g. return <buyer Name="{$s/Name}">{$s/cost}</buyer>
.