
1. Is the cost of the fourth juicer (Juiceman Jr) less than the cost of the fifth juicer (Omega Juicer)?
   Create an XPath expression to answer this question.

   /juicers/juicer[4]/cost &lt; /juicers/juicer[5]/cost


2. Did your XPath expression in (1) return false? Clearly that's incorrect because 82.00 is less than
   234.00. What went wrong? Here's what happened: a dictionary (lexical) comparison was done, not a numeric
   comparison. To ensure that a numberic comparison is done, wrap one of the operands in the number() function.
   Repeat (1) but this time be sure that the output is true.

   number(/juicers/juicer[4]/cost) &lt; /juicers/juicer[5]/cost


3. Write an XPath expression that starts at the top of the document tree, navigates to the first juicer,
   and then selects all of its following juicers (juicer #2, juicer #3, etc).

   /juicers/juicer[1]/following-sibling::juicer


4. Does the fourth juicer (Juiceman Jr) have a cost that is less than *all* the following juicers? Write an XPath
   expression that answers this question?

   This is correct:

   not(number(/juicers/juicer[4]/cost) &gt; /juicers/juicer[4]/following-sibling::juicer/cost)

   This is *not* correct:

   not(/juicers/juicer[4]/cost &gt; /juicers/juicer[4]/following-sibling::juicer/cost)

   In the latter, the comparison is a dictionary (lexical) comparison. In the former, the comparison
   is a numeric comparison, which is what we want.


5. Select each juicer that has a cost less than all of its following juicers.

   for $i in //juicer return if (not(number($i/cost) &gt; $i/following-sibling::juicer/cost)) then $i else ()