Ok, when i force the right XPath factory by using new, that problem goes away. But a new one pops up, where the dtm is null, here
public void setRoot(int root) { // %OPT% Get this directly from the lpi. XPathContext xctxt = wi().getXPathContext(); m_dtm = xctxt.getDTM(root); m_traverser = m_dtm.getAxisTraverser(m_axis); /* HERE m_dtm is null */ m_isFresh = true; m_foundLast = false; m_root = root; m_currentNode = root; if (DTM.NULL == root) { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SETTING_WALKER_ROOT_TO_NULL, null)); //"\n !!!! Error! Setting the root of a walker to null!!!"); } resetProximityPositions(); } AxesWalker.setRoot(int) line: 221 WalkingIterator.setRoot(int, Object) line: 157 XNodeSet(NodeSequence).setRoot(int, Object) line: 265 WalkingIterator(LocPathIterator).execute(XPathContext) line: 212 XPath.execute(XPathContext, int, PrefixResolver) line: 337 XPath.execute(XPathContext, Node, PrefixResolver) line: 303 XPathImpl.eval(String, Object) line: 216 XPathImpl.evaluate(String, Object, QName) line: 281 ExtensionsWithXPath.exfunc(ExpressionContext) line: 28 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 ExtensionHandlerJavaClass.callFunction(String, Vector, Object, ExpressionContext) line: 401 ExtensionHandlerJavaClass.callFunction(FuncExtFunction, Vector, ExpressionContext) line: 440 ExtensionsTable.extFunction(FuncExtFunction, Vector, ExpressionContext) line: 222 TransformerImpl.extFunction(FuncExtFunction, Vector) line: 473 FuncExtFunction.execute(XPathContext) line: 208 FuncExtFunction(Expression).executeCharsToContentHandler(XPathContext, ContentHandler) line: 313 ElemValueOf.execute(TransformerImpl) line: 274 ElemApplyTemplates.transformSelectedNodes(TransformerImpl) line: 395 ElemApplyTemplates.execute(TransformerImpl) line: 178 TransformerImpl.executeChildTemplates(ElemTemplateElement, boolean) line: 2400 TransformerImpl.applyTemplateToNode(ElemTemplateElement, ElemTemplate, int) line: 2270 TransformerImpl.transformNode(int) line: 1356 TransformerImpl.transform(Source, boolean) line: 709 TransformerImpl.transform(Source, Result, boolean) line: 1273 TransformerImpl.transform(Source, Result) line: 1251 ExtensionsWithXPath.main(String[]) line: 21