Bug #2170
closedPassing down object reference to extension function not available
100%
Description
Bug issue initially reported by Gunther Rademacher:
Reports a migration problem between 9.5 and 9.6.
What I would like to do is pass down some object reference into an
XQueryEvaluator, and retrieve it from within an extension function used
by the query. The following worked with 9.5:
...when evaluating an XQuery:
XQueryEvaluator evaluator = executable.load();
evaluator.setExternalVariable(
new QName("data"),
XdmValue.wrap(new ObjectValue("hello world")));
...and in an extension function used by the query:
public Sequence call(XPathContext context, Sequence[]
arguments) throws XPathException
{
ObjectValue parameter = (ObjectValue)
context.getController().getParameter("data");
return new StringValue((String) parameter.getObject());
With 9.6, the getParameter method has disappeared, and it is unclear to
me how to properly adapt the above code. Some debugging shows that my
external variable shows up in
context.getController().getBindery().globalParameters
We need to think of a way of providing access to the global parameters including the defaulted values.
Files
Updated by Michael Kay about 10 years ago
- Status changed from New to Resolved
- Assignee set to Michael Kay
I have added the following method to the Controller class (on the 9.6 and 9.7 branches)
/**
* Get the value of a supplied parameter (XSLT) or external variable (XQuery)
* @param name the QName of the parameter
* @return the supplied value of the parameter, if such a parameter exists, and if a value
* was supplied. Returns null if the parameter is not declared or if no value was supplied,
* even if there is a default defined in the stylesheet or query.
*/
public Sequence getParameter(StructuredQName name);
Updated by Michael Kay about 10 years ago
The JUnit test case is jaxptest.ExtensionTest.testParameterAccess()
Updated by O'Neil Delpratt about 10 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.6.0.2
Bug fix applied to the maintenance release Saxon 9.6.0.2
Updated by O'Neil Delpratt about 9 years ago
- Sprint/Milestone set to 9.6.0.2
- Applies to branch 9.6 added
- Fix Committed on Branch 9.6 added
- Fixed in Maintenance Release 9.6.0.2 added
Please register to edit this issue