I used Sparse table (for LCA) + HLD with fenwick tree to compute the xor quickly.
First, reorder the queries and edges by increasing order of xor value. Now the problem reduces to finding the xor sum of all edges on the path from u to v (more info below). We can handle that using a single point update-range query fenwick tree.
Initially, we set the xor value of all edges in the tree to 0.
Now, let’s say that we want to find the xor sum of edges with weight less than k from nodes u to v. We just set the xor values edges with xor value <= k to their original value. Now, the only edges that will be considered in the xor sum from node u to node v will be those with xor value <= k. We can handle this for each chain using fenwick tree as mentioned above (If you not familiar with HLD, you might need to read up on it).
Query for each chain will be O(logN) because of single query to fenwick tree. Now, we just use HLD to switch chains so that we only need to traverse a logarithmic distance from node u to node v. Time-complexity: O(Q*log^2(N) + NlogN).