Skip to content

Commit fddbfd3

Browse files
committed
[bugfix] passing DB stored nodes to fn:transform
passing persistent nodes from XQuery to fn:transform as parameters doesn’t work. NodeProxy objects were not being considered; dereference their nodes and use the result appropriately.
1 parent 1385801 commit fddbfd3

File tree

1 file changed

+5
-1
lines changed
  • exist-core/src/main/java/org/exist/xquery/functions/fn/transform

1 file changed

+5
-1
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/transform/Convert.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.sf.saxon.type.BuiltInAtomicType;
2727
import org.exist.dom.QName;
2828
import org.exist.dom.memtree.DocumentImpl;
29+
import org.exist.dom.persistent.NodeProxy;
2930
import org.exist.xquery.ErrorCodes;
3031
import org.exist.xquery.XPathException;
3132
import org.exist.xquery.functions.array.ArrayType;
@@ -150,7 +151,7 @@ private XdmValue ofNode(final Node node) throws XPathException {
150151

151152
final DocumentBuilder sourceBuilder = newDocumentBuilder();
152153
try {
153-
if (node instanceof DocumentImpl) {
154+
if (node instanceof Document) {
154155
return sourceBuilder.build(new DOMSource(node));
155156
} else {
156157
//The source must be part of a document
@@ -178,6 +179,9 @@ XdmValue[] of(final ArrayType values) throws XPathException {
178179
}
179180

180181
XdmValue of(final Sequence value) throws XPathException {
182+
if (value instanceof NodeProxy nodeProxy) {
183+
return ofNode(nodeProxy.getNode());
184+
}
181185
return XdmValue.makeSequence(listOf(value));
182186
}
183187

0 commit comments

Comments
 (0)