Douglas, I couldn't agree more with Mark's recommendation to use XQuery for constructing XML nodes, whether it be an element, attribute or what have you. And, yes that feature has been pretty well tested.
For more details, please refer to the constructors<http://www.w3.org/TR/xquery/#id-constructors>section in the XQuery spec. It lets you not only write static XML fragments, but also build dynamic XML fragments on the fly. Regards, Karthick On 1/23/09, Ford, Mark <[email protected]> wrote: > > You should look at XQuery for this use case. I haven't tested with ODE yet > but I saw a post from a while back that the trunk supports XQuery with the > following namespace: > > urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0 > > Your example below would look like this in XQuery: > > <from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0"> > > <c-info xmlns="http://xxx/yyy"> > > <c-id>{$unique-id}</c-id> > <client-id>{$client-id}</client-id> > (: other elements go here :) > </c-info> > </from> > > The text between the curly braces is executable and will produce the > results you're looking for. This is a very simple example of a literal style > XQuery expression. I find this a much better way of constructing elements. > Often times you can collapse many different copy operations into a single > operation which greatly simplifies the coding and maintenance of the > process. > > > > On 1/23/09 2:16 PM, "Jackson, Douglas" <[email protected]> > wrote: > > Hi! > I am trying to create a complex element in an assignment without first > creating a literal element and subsequently filling in values. > > I tried an assignment like the following: > > <from>concat('<c-info xmlns="http://xxx/yyy">', > '<c-id>', $unique-id, '</c-id>', > '<client-id>', $client-id, '</client-id>', > '<type>', 'Type', '</type>', > '<owner>', > $req-msg.req-part/p:r-info/p:user-name, '</owner>', > '<group>', > $req-msg.req-part/p:r-info/p:group, > '</group>', > '</process-info>')</from> > > But Ode interpreted it as: > > <?xml version="1.0" encoding="UTF-8"?> > <c-info xmlns="http://xxx/yyy"><c-info xmlns="http://xxx/yyy > "><c-id>1232736236359-63</c-id><client-id>cmid</client-id><type>Type</type><owner>fred</owner><group>cgroup</group></c-info></c-info> > This would expand to a lot of code with literal + replacement... > > I guess I could write an extension function that would convert the string > to a node... > > Ode could add a new form of <from> like <literal-with-replacement> that > allowed the variables to be substituted. :) > -Doug. > > > > -- Best Regards, Karthick Sankarachary
