How to pass variable parameter into XPath expression?

Given that you’re using the Axiom XPath library, which in turn uses Jaxen, you’ll need to follow the following three steps to do this in a thoroughly robust manner: Create a SimpleVariableContext, and call context.setVariableValue(“val”, “value1”) to assign a value to that variable. On your BaseXPath object, call .setVariableContext() to pass in the context you … Read more