[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Can I pass DOM from the Xalan XSLT processer to a Java object?
Subject: [xsl] Can I pass DOM from the Xalan XSLT processer to a Java object? From: "craig-xsl" <craig-xsl@xxxxxxxxxxxxxxx> Date: Thu, 12 Jun 2003 16:29:38 -0400 |
Hi I have seen that using the xmlns:java="http://xml.apache.org/xslt/java" it is possible to invoke methods on java objects from within an XSL template, for example: <xsl:template match="/language/text()"> <!-- invoke a static method passing in the text node --> <xsl:value-of select="java:com.LSLocale.getJavaString(.)" /> </xsl:template> Is it possible to pass actual DOM from the XSL processor back to a java object? An article at Javaworld.com http://www.javaworld.com/javaworld/jw-12-2001/jw-1221-xslt-p2.html states that "Any Xalan extension function can also take NodeLists or Nodes as arguments and return these types to the XSLT processor". The article demonstrates passing a Node to the XSLT processor but not taking one as an argument as I am trying. So I tried: <-- object instance reference --> <xsl:param name="DOMExtractor" /> <xsl:variable name="tree"> <a> <b> <c> <d/> </c> </b> </a> </xsl:variable> <xsl:template match="root/blah/" > <!-- pass the node to the object --> <xsl:value-of select="java:setDataValue( $DOMExtractor, $tree )" /> </xsl:template> Indeed I end up getting back is a org.w3c.dom.traversal.NodeIterator, specifically a org.apache.xml.dtm.ref.DTMNodeIterator. But when I call the NodeIterator methods to get a Node such as getRoot(), or nextNode() NullPointers are thrown. I could cast to the DTMNodeIterator but I have examined the object & it appears to be a flat representation of the tree, not DOM. Anyone know if there a way to get a DOM Element out of xalan? I'm using Xalan 2.4.D1 jdk 1.3.1 Thanks, Craig XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] doctype declaration and m, Lars Huttar | Thread | RE: [xsl] doctype declaration and m, Whitney, Dan (CanWes |
RE: [xsl] entity output, Passin, Tom | Date | Re: [xsl] entity output, David Carlisle |
Month |