Re: [Xmldb-org-xupdate] Poorly defined update instruction
Brought to you by:
reinhapa
|
From: Wolfgang M. <wol...@ex...> - 2005-04-29 08:41:33
|
> 3) It would be useful for update to allow element, attribute, etc. as > content. That said, I'm not convinced it's worth the complexity, as you > can simply delete the element and reinsert it with the new content. I would like to propose a "replace" instruction for this purpose. Maybe I'm wrong, but to replace an element by first deleting and then reinserting it, you need to keep track of the element's position. This is certainly possible (using a variable, for example), but a distinct "replace" expression would make it easier and leaves it to the XUpdate implementation to remember the previous position. Example: <xupdate:replace select="/example/p[2]"> <quote>a <b>replaced</b> paragraph</quote> </xupdate:replace> Concerning "update", I would still allow element, text etc. as content if the "select" xpath evaluates to one or more elements. Otherwise, the expression just updates the value of an attribute or text node. Wolfgang |