This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Implementing "value-of" on a (DOM) Node
- To: xsl-list at mulberrytech dot com
- Subject: Re: Implementing "value-of" on a (DOM) Node
- From: Gerard Maas <gerard dot maas at alcatel dot be>
- Date: Tue, 21 Nov 2000 18:57:31 +0100
- References: <3A1A96B0.72CE98C@alcatel.be>
- Reply-To: xsl-list at mulberrytech dot com
Well, In my hurry I found a way to do it:
XObject obj = XPathAPI.eval(node,".");
String result = obj.toString();
If the node is a element node with children, you could even refer to them
using the relative XPath
XObject obj = XPathAPI.eval(node,"-path goes here-");
I'm very happy it's working!
It is even possible to iterate over a nodeList. That's useful to generate
things like tables or menus.
Thanks anyway!! :-)
Gerard.
Gerard Maas wrote:
> Hi,
>
> I'm currently working in a project involving Cocoon as framework where
> I'm trying to integrate Generic XML data sources into XML templates to
> be "cocoonized": fed into the Cocoon reactor to tranform the resulting
> XML in a compatible form for the target device (VoiceXML, XHtml, WAP...)
>
> While doing this, I've been having difficulties to implement the
> insertion of XML 'pieces' (a piece (for me) is a XPath retrieving only
> one subtree).
> The XPath stuff is alredy working but I'm stuck trying to get the value
> of the node retrived by the call to XPath. I get a org.w3c.dom.Node and
> I'd like to apply a function that would retrieve what xsl:value-of
> select=<this node> would.
> I saw the XSLT processor implementation (XALAN) but I can't get a grip
> in the code (ElementValueOf). Is there somewhere a more comprehensive
> way to do that?
>
> ValueOf (org.w3c.dom.Node) :- String
>
> Thanks in advance,
>
> Gerard.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list