All, My original post (see below) discussed the problem I was having processing (via XPATH) a nodeset returned from a JAVA function call. In the original trials, I was returning a java.lang.String. I since modified my JAVA function to return an org.w3c.dom.Node object and am experiencing the same problem in the XSL processing of this return result. That is, I can place the entire RTF that comes from my JAVA call into the result tree but any applied XPATH statements on it don't seem to do anything. Is it possible that the Xalan processor is seeing "escaped" data and so does not recognize the data as a true RTF? Interestingly, if I put this same RTF into the XSL directly, things work fine. That is, if I have: <xsl:variable name="klient"> <DOCUMENT>doclevel<ELEM1>elem1level<ELEM1A>FOO</ELEM1A></ELEM1></DOCUMENT> </xsl:variable> ...and I don't use the nodeset extension function and try this... <xsl:value-of select="$klient/DOCUMENT/ELEM1/ELEM1A"/> I get the error: "XSLT Error (javax.xml.transform.TransformerException): Can not convert #RTREEFRAG to a NodeList!" (Note: If I use the document() command to pull in this same RTF from a file URI, the above select statement works fine which is very convenient) ...however, if I then surround the RTF with the nodeset function like this: <xsl:value-of select="xalan:nodeset($klient)/DOCUMENT/ELEM1/ELEM1A"/> ...this will then correctly return the element value "FOO". AS MENTIONED EARLIER, THIS DOES NOT WORK IF THE SAME DATA FOR VARIABLE "klient" IS RETURNED FROM A JAVA FUNCTION CALL. More importantly, this does not work either when I return a java.lang.String or a org.w3c.dom.Node object. Is this a bug? Any ideas? ...anyone...? Bart Jenkins, CTO Globeflow SA Cardenal Marcelo Spinola 2, D1, Planta 6 28016 Madrid, Spain telephone: +34 667 65 10 75 > -----Original Message----- > From: Bart W.Jenkins > Sent: Wednesday, July 25, 2001 7:22 PM > To: '[EMAIL PROTECTED]' > Subject: How to correctly process, via Xpath, result-tree-fragments > returned by JAVA extensions? > > All, > Environment: > OS = Windows 2000 Pro > JAVA=java full version "1.3.1-b24" > Xalan=xalan-j_2_2_D6 > > I have XSL that uses the Xalan JAVA extensions mechanism to make calls to > JAVA code to return both simple types (like String) and > result-tree-fragments like the following: > > <DOCUMENT> > <ELEM1> > <ELEM1A>Foo</ELEM1A> > </ELEM1> > </DOCUMENT> > > Problem: Why, when I apply the "xalan:nodeset()" function to my RTF that > comes back from my JAVA function can I not use XPATH statements to get at > specific elements or attributes in my RTF data? > > Example: Assuming I have a declaration like: > > <?xml version='1.0' encoding='ISO-8859-1' ?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:Ext="class:com.hg.client" > xmlns:xalan="http://xml.apache.org/xalan" > exclude-result-prefixes="Ext xalan" > > > > I then call into a JAVA function like this: > > <xsl:variable name="myRTF" > select='Ext:myClass.myMethod("someParamData")'/> > > Which does indeed return an RTF which I can see fully if I do a value-of > like: > > <xsl:value-of select="myRTF"/> > > Now, assuming I want the value of "<ELEM1A>" which is "Foo", I assume I > should do this: > > <xsl:value-of select="xalan:nodeset(myRTF)/DOCUMENT/ELEM1/ELEM1A"/> > > But this returns NOTHING and gives NO ERROR. Can someone tell me why? > > Thanks in advance... > > Bart Jenkins, CTO > Globeflow SA > Cardenal Marcelo Spinola 2, D1, Planta 6 > 28016 Madrid, Spain > telephone: +34 667 65 10 75 >
