You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/11/15 23:47:06 UTC

svn commit: r595480 - /ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java

Author: mriou
Date: Thu Nov 15 14:47:05 2007
New Revision: 595480

URL: http://svn.apache.org/viewvc?rev=595480&view=rev
Log:
Fixed a bug on XPath 1.1 doXslTranform where the wrong type of element was injected in Saxon.

Modified:
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java?rev=595480&r1=595479&r2=595480&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath10/runtime/JaxenContexts.java Thu Nov 15 14:47:05 2007
@@ -43,6 +43,7 @@
 import org.jaxen.XPathFunctionContext;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 import javax.xml.namespace.QName;
@@ -56,6 +57,8 @@
 import java.util.List;
 import java.util.Map;
 
+import net.sf.saxon.dom.NodeWrapper;
+
 
 /**
  * Implementation of the various JAXEN evaluation contexts in terms of the
@@ -311,7 +314,11 @@
                                             "element node."));
                     varElmt = (Element) elmts.get(0);
                 } else {
-                    varElmt = (Element) args.get(1);
+                    if (args.get(1) instanceof NodeWrapper)
+                        varElmt = (Element) ((NodeWrapper)args.get(1)).getUnderlyingNode();
+                    else varElmt = (Element) args.get(1);
+                    
+//                    varElmt = (Element) args.get(1);
                 }
             } catch (ClassCastException e) {
                 throw new WrappedFaultException.JaxenFunctionException(
@@ -348,7 +355,10 @@
                 }
             }
 
-            DOMSource source = new DOMSource(varElmt);
+            Document varDoc = DOMUtils.newDocument();
+            varDoc.appendChild(varDoc.importNode(varElmt, true));
+
+            DOMSource source = new DOMSource(varDoc);
             // Using a StreamResult as a DOMResult doesn't behaves properly when the result
             // of the transformation is just a string.
             StringWriter writerResult = new StringWriter();