Passing parameters into an XProc Pipeline is structurally very similar to passing them into Named Queries. The URI is still query.rq?results&variableName=variable.  However, once the paramater has been successfully passed into the pipeline the pipeline must interpret it correctly depending on where it will be used. It starts the same way, with the <p:option> tag. The name attribute assigns the paramter a name while the required attribute states whether or not the parameter is necessary for the pipeline to execute.

From there, if the intent is to use the parameter in a named query, the query string must be built up inside the <p:load> tag in order for it to be passed correctly to the named query. In this example the <p:with-option> tag two attributes: the name attribute which defines it as a link (href) and the select attribute which defines where to look for that link. Inisde the select attribute is where the query string must be constructed using the concat function. The string is simply the file name for the query (nuclear-chemical-amount.rq), the suffix that returns results in SPARQL/XML (?results) and the URI-encoded variable name and string (&amp;substance='encode-for-uri($substance)). $substance here refers to the option that was defined in the previous step.

After this step, the SPARQL/XML that is returned can be passed to any other necessary steps just as it could be in a pipeline that does not use parameters.

<?xml version="1.0" encoding="UTF-8" ?>
<p:pipeline version="1.0" 

<p:serialization port="result" media-type="application/json" method="text" /> 

<p:option name="substance" required="true" /> 


<p:xslt name="piechart">
    <p:input port="stylesheet">
        <p:document href="../coordinate-points-d3-json-sparql.xsl" /> 
    <p:with-param name="x-coordinate-variable" select="'name'" /> 
    <p:with-param name="y-coordinate-variable" select="'total'" />