5. The apparatus of claim 4 , wherein the incorporation module is further configured to incorporate a replication of a predicate of the LET binding with each replicated LET binding to provide the XPath predicate.
4. An apparatus for handling a LET binding during an XML pivot join, the apparatus comprising: an identification module stored on a memory and executed by a processor, the identification module configured to receive an XQuery “FOR, LET, WHERE, ORDER BY, and RETURN” (“FLWOR”) expression for identifying at least one XML document that matches the XQuery FLWOR expression; the identification module further configured to identify a LET binding of the XQuery FLWOR expression, wherein the LET binding comprises a context step in a WHERE clause within the XQuery FLWOR expression; the identification module further configured to identify at least one logical expression within the WHERE clause, the at least one logical expression comprising next expression steps separated by logical operators; an incorporation module configured to incorporate a replication of the LET binding with each next expression step within the WHERE clause to provide an XPath predicate; a rewrite module configured to replicate a query tree of the XML pivot join procedure starting with the LET binding and combining the query tree with a paths tree to form a match graph, wherein replicating the query tree comprises replicating the LET binding for every next step of the WHERE clause, the query tree comprising each replication of the LET binding such that each replication of the LET binding comprises a single child in the query tree, the match graph indicating each replication of the LET bindings within the query tree; and the rewrite module further configured to rewrite, based at least in part on the match graph, the XQuery FLWOR expression into an XPath query using the FOR binding of the XQuery FLWOR expression as a context step followed by the XPath predicate.