Permalink
Browse files

Attempt to fix issue #82, make sure that 'inner pipelines' in an cx:e…

…val register extension functions with the correct context
  • Loading branch information...
ndw committed Mar 8, 2013
1 parent 898f69f commit 9852719bbe7aea23ce0cc14e8d6ba0190ddda2af
Showing with 21 additions and 0 deletions.
  1. +18 −0 src/com/xmlcalabash/core/XProcRuntime.java
  2. +3 −0 src/com/xmlcalabash/extensions/Eval.java
@@ -251,9 +251,27 @@ public XProcRuntime(XProcRuntime runtime) {
transparentJSON = runtime.transparentJSON;
jsonFlavor = runtime.jsonFlavor;
profileFile = runtime.profileFile;
exFuncs.add(new Cwd(this));
exFuncs.add(new BaseURI(this));
exFuncs.add(new ResolveURI(this));
exFuncs.add(new SystemProperty(this));
exFuncs.add(new StepAvailable(this));
exFuncs.add(new IterationSize(this));
exFuncs.add(new IterationPosition(this));
exFuncs.add(new ValueAvailable(this));
exFuncs.add(new VersionAvailable(this));
exFuncs.add(new XPathVersionAvailable(this));
reset();
}
public void resetExtensionFunctions() {
for (XProcExtensionFunctionDefinition xf : exFuncs) {
processor.registerExtensionFunction(xf);
}
}
public void close() {
for (XProcExtensionFunctionDefinition xf : exFuncs) {
xf.close();
@@ -103,6 +103,7 @@ public void run() throws SaxonApiException {
XdmNode piperoot = S9apiUtils.getDocumentElement(pipedoc);
XProcRuntime innerRuntime = new XProcRuntime(runtime);
innerRuntime.resetExtensionFunctions();
QName stepName = getOption(_step, (QName) null);
XPipeline pipeline = null;
@@ -266,5 +267,7 @@ public void run() throws SaxonApiException {
result.write(tree.getResult());
}
}
runtime.resetExtensionFunctions();
}
}

0 comments on commit 9852719

Please sign in to comment.