i have an xml File, below is snippet from the file
<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
<Products>
<ProductID>37</ProductID>
<ProductName>Gravad lax</ProductName>
<SupplierID>17</SupplierID>
<CategoryID>8</CategoryID>
<QuantityPerUnit>12 - 500 g pkgs.</QuantityPerUnit>
<UnitPrice>26</UnitPrice>
<UnitsInStock>11</UnitsInStock>
<UnitsOnOrder>50</UnitsOnOrder>
<ReorderLevel>25</ReorderLevel>
<Discontinued>0</Discontinued>
</Products>
<Products>
<ProductID>38</ProductID>
<ProductName>Côte de Blaye</ProductName>
<SupplierID>18</SupplierID>
<CategoryID>1</CategoryID>
<QuantityPerUnit>12 - 75 cl bottles</QuantityPerUnit>
<UnitPrice>263.5</UnitPrice>
<UnitsInStock>17</UnitsInStock>
<UnitsOnOrder>0</UnitsOnOrder>
<ReorderLevel>15</ReorderLevel>
<Discontinued>0</Discontinued>
</Products>
</Products>
</dataroot>
I then use XQuery to locate the max UnitPrice which is $263.50, Xquery Shown below
xquery version "1.0";
<dataroot>
{
let $x := doc("../xmlFiles/Products.xml")/dataroot/Products
let $y := max($x/UnitPrice)
return
<MaxPrice>
{<UnitPrice>{$y}</UnitPrice>}
</MaxPrice>
}
</dataroot>
How do i go about getting the other nodes associated with this max UnitPrice?