You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Voytenko, Dimitry" <DV...@SECTORBASE.COM> on 2000/09/07 21:32:44 UTC
RE: How to return a node-set from an extension?
This is how I did it
// Class for node-set function
public class FuncNodeSet extends Function {
public XObject execute (XPath path, XPathSupport execContext, Node
context, int opPos, Vector args)
throws org.xml.sax.SAXException {
if (args.size() < 1) {
throw new org.xml.sax.SAXException ("Wrong number of parameters for
function \"node-set\"");
}
XObject obj = (XObject)args.elementAt(0);
if (obj instanceof XNodeSet) {
return (XNodeSet) obj;
}
if (obj instanceof XRTreeFrag) {
XRTreeFrag tree_frag = (XRTreeFrag) obj;
XNodeSet node_set = new XNodeSet (tree_frag.convertToNodeset());
return node_set;
}
return new XNodeSet();
}
}
// plug this function
private static synchronized void addXSLTAddons () {
.....
XPath.installFunction ("node-set", new FuncNodeSet());
.....
}
That's all
Dmitry E. Voytenko
Sectorbase.com
-----Original Message-----
From: greg keraunen [mailto:gkeraunen@valinux.com]
Sent: Thursday, September 07, 2000 12:42
To: xalan-dev@xml.apache.org; DVoytenko@SECTORBASE.COM
Subject: Re: How to return a node-set from an extension?
"Voytenko, Dimitry" wrote:
>
> In the Xalan-J XRTreeFrag there is method convertToNodeSet(). It does all
> the work. I just wrote extension function node-set() that calls this
method.
> So now I can use
> <xsl:variable name="subtree">
> <!-- anything -->
> </xsl:variable>
> <xsl:variable name="psubtree" select="node-set($subtree)"/>
> <xsl:value-of select="$psubtree/......"/>
Is the node-set() extension function available for download?
I really need this functionality too!
--
greg keraunen <gk...@valinux.com> 408-542-8600 x8085
web software engineer