
1. Make the fourth juicer the context node. How many preceding siblings does it have?
   Create an XPath expression that answers that question.

   for $i in . return count(preceding-sibling::*[name() eq name($i)])


2. Extend (1). Create a sequence composed of:

   '[', the number of preceding siblings, ']'

   ('[', for $i in . return count(preceding-sibling::*[name() eq name($i)]) + 1, ']')


3. In (2) you created a sequence of items. Now I want you to smash together all of
   those items, thus resulting in a single string.

   concat('[', for $i in . return count(preceding-sibling::*[name() eq name($i)]), ']') 


4. In (3) your result was an XPath predicate. However, the number in the predicate is
   off my one, i.e., for the fourth juicer it should be [4] not [3]. Update your XPath
   from (3).

   concat('[', for $i in . return count(preceding-sibling::*[name() eq name($i)]) + 1, ']')


5. Update (4). Put the name of the node prior to the predicate.

   concat(name(), '[', for $i in . return count(preceding-sibling::*[name() eq name($i)]) + 1, ']')


6. Create an absolute XPath expression to your context node, include a predicate for
   each node along the path, e.g.

   juicers[1]/juicer[4]

   string-join(for $i in ancestor-or-self::* return concat(name($i), '[', for $j in $i return count(preceding-sibling::*[name() eq name($j)]) + 1, ']'),'/')

 
7. Prepend the XPath generated in (6) with '/', e.g.,

   /juicers[1]/juicer[4]

   concat('/', string-join(for $i in ancestor-or-self::* return concat(name($i), '[', for $j in $i return count(preceding-sibling::*[name() eq name($j)]) + 1, ']'),'/'))
