Passing parameters to an XQuery or XSLT through an XProc Pipeline

I’ve recently been helping someone get started with the XML REST Framework, and they asked about getting query string parameters into the XQueries or XSLTs that were a part of their resource implementation. For those of you who are not familiar, what the XML REST Framework does is leverages Spring MVC for all of the HTTP protocol stuff, a developer builds a very thin Java shim to an XProc pipeline that implements the RESTful service. The post I link to above and two earlier versions explain this all in more detail. What I am focusing on in this post is how I can get values from the query string into the right places within my pipeline; there are two parts to this. 1) you need to get your hands on the query string argument and 2) you need to pass that into the XProc pipeline in such a way that it gets to the XQuery or XSLT. It turns out that #2 was already demonstrated in the Patients.java class file in combination with the resourceGET.xpl. Let’s drill in on that a little bit.