Re: writing to xpath string result

Axel Hecht <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Brian Ryner wrote:
> Hi,
> 
> One thing I've found that would be really helpful for xforms is, given 
> data like:
> 
> <foo>
>   <bar name="blah">text</bar>
> </foo>
> 
> and xforms input controls bound to:
> 
> /foo/bar
> and
> /foo/bar@name
> 
> to be able to evaluate that xpath expression and write new data to the 
> resulting text node or attribute, without having to figure out which one 
> it is (since xpath can do that anyway).  Basically, to be able to set 
> the stringValue attribute on the result.  The semantics of this, at 
> least for my purposes, would be pretty straightforward... it would only 
> need to work for a single-node result, and if the expression points to 
> the text node child of an element, it can blow away any existing 
> children of the element and replace them with a new text node.
> 
> Any thoughts on this?
> 

I have been thinking about this a bit more and I don't think that you 
need anything special at all, just evaluate to a nodeset, get the first 
node and set your content. You may want to have your own little helper 
function for this, if it pops up at a few places, but I don't see a 
requirement to hook this up to the xpath engine itself.

Axel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.