cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Chamberlain <>
Subject Re: Passing a node-set from XSLT to Java
Date Thu, 03 Jul 2008 11:16:14 GMT
Hi Luca/All,

Sorry.  On further testing, we're still not getting through the full 
tree fragment to Java.

I've adapted the java method to give details of what it receives:

  public String addGML(org.w3c.dom.Node myNode)
       System.out.println("Class = "+node.getClass().getName());
       System.out.println("Name = "+node.getNodeName());
       System.out.println("Has children = "+(node.hasChildNodes()?"Yes":"No"));
       System.out.println("First Child Name = "+node.getFirstChild().getNodeName());
       System.out.println("First Child Text = "+node.getFirstChild().getTextContent());

and from this comes the following output:

  Class = org.apache.xml.dtm.ref.DTMNodeProxy
  Name = gml:Polygon
  Has children = Yes
  First Child Name = #text

The last line (which uses the getTextContent() method) throws the 
following exception:

javax.xml.transform.TransformerException: java.lang.AbstractMethodError: 

Firstly, I was expecting the Class to be "org.w3c.dom.Node", so does 
anyone know how I can enable this?  I was also expecting the name of the 
first child to be "gml:exterior" instead of a "#text".  The XML I'm 
sending is given below:

    <gml:Polygon gml:id="GATS1153_10">
          <gml:posList srsDimension="2">-155.42 55.58</gml:posList>

Is it possible I actually need to pass a tree fragment, rather than a 

As a reminder, the XSLT given below.  Any help would me greatly 
appreciated.  In simple terms, I'm just trying to pass the above XML 
from XSLT to Java, preferably as a w3c Node.

Kind regards,



  <xsl:stylesheet ... myClass="xalan://">
    <xsl:variable name="gmlAdder" select="myClass:new()"/>

    <xsl:variable name="gml">
      <xsl:copy-of select="@* | node()"/>

    <xsl:variable name="result" select="myClass:addGML($gmlAdder,$gml)"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message