Permalink
Browse files

Fix #247 by hand; thanks @fgeorges

  • Loading branch information...
ndw committed Dec 15, 2016
1 parent 58c7153 commit ad09356a8bee1470c493b30ba3838b4cd0ec51f4
Showing with 25 additions and 13 deletions.
  1. +25 −13 src/main/java/com/xmlcalabash/library/XQuery.java
@@ -19,25 +19,33 @@
package com.xmlcalabash.library;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
import com.xmlcalabash.core.XMLCalabash;
+import com.xmlcalabash.core.XProcConstants;
+import com.xmlcalabash.core.XProcException;
+import com.xmlcalabash.core.XProcRuntime;
import com.xmlcalabash.io.ReadablePipe;
import com.xmlcalabash.io.WritablePipe;
import com.xmlcalabash.model.RuntimeValue;
-import com.xmlcalabash.core.XProcException;
-import com.xmlcalabash.core.XProcRuntime;
-import com.xmlcalabash.core.XProcConstants;
-import net.sf.saxon.lib.CollectionURIResolver;
-import net.sf.saxon.s9api.*;
-import net.sf.saxon.Configuration;
import com.xmlcalabash.runtime.XAtomicStep;
-import com.xmlcalabash.util.TreeWriter;
-import com.xmlcalabash.util.CollectionResolver;
import com.xmlcalabash.util.Base64;
+import com.xmlcalabash.util.CollectionResolver;
import com.xmlcalabash.util.S9apiUtils;
+import com.xmlcalabash.util.TreeWriter;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.lib.CollectionURIResolver;
+import net.sf.saxon.s9api.Processor;
+import net.sf.saxon.s9api.QName;
+import net.sf.saxon.s9api.SaxonApiException;
+import net.sf.saxon.s9api.XQueryCompiler;
+import net.sf.saxon.s9api.XQueryEvaluator;
+import net.sf.saxon.s9api.XQueryExecutable;
+import net.sf.saxon.s9api.XdmItem;
+import net.sf.saxon.s9api.XdmNode;
+import net.sf.saxon.s9api.XdmNodeKind;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
/**
*
@@ -122,7 +130,11 @@ public void run() throws SaxonApiException {
Processor qtproc = runtime.getProcessor();
XQueryCompiler xqcomp = qtproc.newXQueryCompiler();
xqcomp.setBaseURI(root.getBaseURI());
- xqcomp.setModuleURIResolver(runtime.getResolver());
+
+ if (xqcomp.getModuleURIResolver() == null) {
+ xqcomp.setModuleURIResolver(runtime.getResolver());
+ }
+
XQueryExecutable xqexec = xqcomp.compile(queryString);
XQueryEvaluator xqeval = xqexec.load();
if (document != null) {

0 comments on commit ad09356

Please sign in to comment.