title: XQuery to append node to existing node set
body: <p>I am new to working with XQuery and XSLT. WebLogic is using XQuery 1.0.</p>
  
  <p>I have a WebLogic composite and I have a collection of nodes and just want to add a node to an existing node set in an XQuery assignment. My current solution seems too heavyweight. I will be dealing with tens of thousands of records and it seems to me there should be a really easy way to just insert a node under another node and return it.</p>
  
  <pre><code>declare function local:func($svdPpl as element() (:: element(*,  sv:svdPpl) ::), 
                              $svdPsn as element() (:: element(*, sv:svdPsn) ::)) 
                              as element() (:: element(*,  sv:svdPpl) ::) {
     &lt;sv:svdPpl&gt;
     {for $psn in $svdPpl return $psn} {$svdPsn}
     &lt;/sv:svdPpl&gt;
  };
  </code></pre>
  
  <p>If I understand XQuery correctly that means millions of loops just to add records to existing node sets. I have tried using the insert node $svdPsn into $svdPpl syntax but that is causing validation errors in the WebLogic editor.</p>
  
  <p>Any help is appreciated.</p>