From: <mgr...@co...> - 2003-08-28 19:05:22
|
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 > > |