
1. Output the name of every element in the document.

   for $i in //* return name($i)


2. Output the name of every attribute in the document.

   for $i in //@* return name($i)


3. Output the name and cost of the first juicer. Repeat for the other juicers.

   for $i in //juicer return ($i/name, $i/cost)


4. For the sequence generated in (1), what positions does 'juicer' occur at? Create an XPath
   expression to answer this question.

   index-of(for $i in //* return name($i), 'juicer')


5. Compute the average for all the integers from one to one hundred.

   avg((1 to 100))


6. List the names of all the juicers in the document, in reverse order.

   reverse(//name)


7. The currency conversion rate between US dollars and Canadian dollars is 1:1.2 (1 US dollar = 1.2 Canadian
   dollars). Print the name of each juicer followed by its cost in Canadian dollars.

   for $i in //juicer return ($i/name, $i/cost * 1.2)