From: Daniel S. <sh...@ir...> - 2003-08-28 19:26:43
|
That works ok for attributes, but what if you want to update an XML node? In that case would it be favorable to have multiple right hand side actions before doing the affectation? In many cases the replacement is a construction of elements rather than simply another part of the tree. Daniel Shane -----Original Message----- From: xml...@li... [mailto:xml...@li...]On Behalf Of mgr...@co... Sent: Thursday, August 28, 2003 2:54 PM To: xml...@li... Cc: Daniel Shane Subject: RE: [Xmlstar-devel] Great! Here is what was my original thinking on using XPATH expressions in r-values for edit. Right now to update attribute value you would do something like xml ed -u //@id -v 2 //@id - points to a node being updated 2 - specifies value (constant) Here is how I would envision incremental update xml ed -u //@id -x "@id+1" //@id - points to a node/nodes being updated and gives a context for xpath expressions @id+1 - specifies xpath expression within the context defined in -u option. This expression evaluates and its value is assigned to a node selected in -u. Something like that... --Mikhail > I did not put much thought yet but here is an idea... > > With the xml ed, we are actually replacing something with something else. So > the basic idea is xml ed -u "..." -x "..." where -u is the r-left and -x is > the r-right values. > > However, it is often difficult to construct an XPath for the r-value in one > statement. I was rather thinking something in the line of : > > xml ed -u "..." -r ...multiple statements... > > In multiple statements we must be able to match (-m), copy (-c), add a tag > (-e), get a value (-v), evaluate an XPath (-x), delete a tag (-d) and maybe > more. Each of these actions are "piped" together as usual, and the result of > the last command will be pasted in the l-value. I dont know what can happen > if you try to replace an attribute with an XML node instead of a value? > > Therefore we could do something like: > > xml ed -u "..." -r -m "/Record/Number" -v "node()" -x "some XPath that adds > 1 to the -v" ... > > This example is obvisouly overkill for what it does. > > Daniel Shane > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ xmlstar-devel mailing list xml...@li... https://lists.sourceforge.net/lists/listinfo/xmlstar-devel |