Hi Hussein, Just FYI, here's what I did, and it works. It's clumsy, but I need to move on to other jobs:
<commandname="insertStateNames2"> <macroundoable="true"repeatable="true"> <sequence> <commandname="insertNode"parameter="sameElementAfter[implicitElement]"/> <commandname="putAttribute"parameter="name '%0'"/> <setvariable="selectedElement"context="$selected"expression="following::pmc:signal"/> <setvariable="selectedElement"context="$selected"expression="pmc:state[last()]"/> <commandname="insertStateNames2"parameter="'%0'"/> </sequence> </macro> </command> <commandname="insertStateNames"> <macroundoable="true"repeatable="true"> <sequence> <commandname="xpathSearch"parameter="//ns:signal/ns:state[last()]"/> <getexpression="join(//pmc:testComponent/pmc:states/pmc:state/@name, ' ')"/> <commandname="pick"parameter="'Choose state:' false %_"/> <commandname="insertStateNames2"parameter="'%_'"/> </sequence> </macro> </command>? This allows the user to select a state name, then adds a new field for the state state to every "signal" element. Since there are often hundreds of signals, automating this was important. ? Cheers, Jeff. ----- Original Message ---- > From: Hussein Shafie <hussein at xmlmind.com> > To: Jeff Hooker <jeff at itwriting.ca> > Cc: "xmleditor-support at xmlmind.com" <xmleditor-support at xmlmind.com> > Sent: Sat, December 12, 2009 12:28:24 AM > Subject: Re: [XXE] Recursion and XMLmind commands > > Jeff Hooker wrote: > > > > What the command below does it pretty obvious to you, I'm sure. > > Not really. > > > ? ? ? ? parameter="//ns:signal/ns:state[last()]"/> > > is not easy to understand given what you want to do. > > > > What's not obvious to me is how to recurse the command so that rather than > just adding a new "state" element to the first "signal" element, it adds a > new > "state" element to every "signal" element in the document. > > > > There's no easy way of doing this, is there? > > > > > > > >? ? > >? ? > >? ? ? > >? ? ? parameter="'Choose state:' false %_"/> > >? ? ? > >? ? ? > >? ? ? > >? ? ? > ? ? context="$selected" > ? ? expression="following::pmc:signal"/> > > to select next signal element. > > See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpath_vars.html > > Instead, it's also possible to use command selectNode (more efficient; > does not support namespace prefixes: use Clark's notation for qualified > names). > > See > http://www.xmlmind.com/xmleditor/_distrib/doc/commands/selectNode.html > > > > > -- > XMLmind XML Editor Support List > xmleditor-support at xmlmind.com > http://www.xmlmind.com/mailman/listinfo/xmleditor-support

