IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Need update insert with position variable XQuery help

    Posted 03/02/07 04:41 PM

    I’ve got one instance of doctype //TOC:

    <TOC xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xsi . . . . >










    <Book . . . .>
    <LevelOne . . . .>
    <LevelTwo . . . .>
    <LevelTwo . . . .>


    I’m trying to insert a new element under the Book element. This is supported in the TOC schema. I would like the value of the Position element to be the Book element position number, IE:

    <TOC. . . >
    <Book. . .>
    1
    <Level . . . . .

    <Book. . .>
    2
    <Level . . . . .

    <Book. . .>
    3
    <Level . . . . .

    . . . . .

    The closest I’m getting to doing this is with the XQuery:

    update
    for $a in input()//TOC
    do (insert (for $b at $c in $a/Book return {$c}) into $a/Book)

    But the result I get is this:

    <TOC. . . >
    <Book. . .>
    1
    2
    3
    <Level . . . . .

    <Book. . .>
    1
    2
    3
    <Level . . . . .

    <Book. . .>
    1
    2
    3
    <Level . . . . .

    . . . . .

    I tried different XQueries but to no avail. Can someone give a suggestion on how I can get the desired result with XQuery?

    Thanks :slight_smile:


    #Tamino
    #webMethods
    #API-Management


  • 2.  RE: Need update insert with position variable XQuery help

    Posted 03/02/07 04:50 PM

    #Tamino
    #API-Management
    #webMethods


  • 3.  RE: Need update insert with position variable XQuery help

    Posted 03/02/07 04:52 PM

    Sorry about the quote! I could not delete it . . . .


    #webMethods
    #Tamino
    #API-Management


  • 4.  RE: Need update insert with position variable XQuery help

    Posted 03/02/07 07:03 PM

    you might want to try

    
    update
    for $a in input()/TOC
    for $b at $pos in $a/Book do
    insert <Position>{$pos}</Position> into $b

    Regards

    Harald


    #API-Management
    #webMethods
    #Tamino


  • 5.  RE: Need update insert with position variable XQuery help

    Posted 03/02/07 08:26 PM

    :stuck_out_tongue: Thanks so much!

    Awesome solution!


    #API-Management
    #Tamino
    #webMethods