When I run a a xupdate on a document with multiple appends like so: <xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate"> <xupdate:append select="/EML[HEAD/TEMPLATE_DOC_ID='BBT_0_1']" child="1"> <xupdate:comment>File modified on:Tue Jul 27 12:43:23 MDT 2004 By byrne</xupdate:comment> </xupdate:append> <xupdate:append select="/EML[HEAD/TEMPLATE_DOC_ID='BBT_0_1']/BODY"> <xupdate:element name="TextField4"></xupdate:element> </xupdate:append> </xupdate:modifications>
On a XML document that looks like this: <EML> <HEAD> <TEMPLATE_DOC_ID>BBT_0_1</TEMPLATE_DOC_ID> </HEAD> <BODY> </BODY> </EML> I get this result: <EML> <!--File modified on:Tue Jul 27 12:43:23 MDT 2004 By byrne --> <!--File modified on:Tue Jul 27 12:43:23 MDT 2004 By byrne --> <HEAD> <TEMPLATE_DOC_ID>BBT_0_1</TEMPLATE_DOC_ID> </HEAD> <BODY> <TextField4/> <TextField4/> </BODY> </EML> So I tracked down what I believe is the issue in the source code. The execute code for collections loops through the attributes looking for "selects". Pulls the nodes that match the XPath and then runs both commands on selected nodes then repeats this for the other commands. My rough idea would be to select the correct nodes then apply the individual update command on each selected node. Then repeat the process for each xupdate command. This would is similar to the execute(Node contextNode) in XUpdateImpl where each command gets executed once on the documents that match the "select". I have a working example of the new org.apache.xindice.core.xupdate.XUpdateImpl but I need to more testing of various xupdate queries and get some feed back on correct xupdate operation on collections. Todd Byrne