XML : How to insert elements in nodes in xpath

I have the following code:

  for $subject in $subjects/subject  return        <subject id="{$subject/@id}">            <foo/>       </subject>    

However the above code does not show all the attributes of subject. Only id. Of course I can continue hardcoding more attributes but this won't help if I don't know what the attributes names are.

I believe the solution would be something like this:

  for $subject in $subjects/subject  return        insert-child( <foo/>, $subject)    

How do I do this?

No comments:

Post a Comment