On Mon, 15 Sep 2008 10:55:08 -0700, Florent Georges <[EMAIL PROTECTED]> wrote:

Eric Palmitesta wrote:

  Hi

It works.  Is there a better way though?  Also, what's the
point of xdmp:node-insert-child if it can't operate on an
argument to a function?

  Yes it can, but not on constructed nodes.  You can make a bit
more generic:

    define function g($x as element()) as element()
    {
       element { node-name($x) } {
         $x/text(),
         $x/child::*,
         $x/attribute::*,
         attribute new{ "new" }
       }
    }


Actually, you need to be a little careful here.
Attributes should come first, and the query above will reorder
text children relative to your element children.  What you want is:

element {node-name($x)} {
  $x/@*,
  attribute new {"new"},
  $x/node()
}

//Mary
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to