I figured it out.  It's the $lowercase and $uppercase variables that need to be mapped to $p1 and $p2 when used in saxon:evaluate().