webMethods

webMethods

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.

 View Only
  • 1.  xquery

    Posted Tue May 13, 2003 07:33 PM

    I would like to replace only element different from something…

    update replace input()/myelement//el_to_replace[different from value] with <el_to_replace>newvalue</el_to_replace>

    How can i express different from value in this query?
    Eg.

    ckdjfk
    hello
    bye
    i wold like to replace all element DIFFERENT from hello
    so that it results
    newvalue
    hello
    newvalue

    BRGS,
    @nto


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: xquery

    Posted Wed May 14, 2003 01:00 PM

    Hello,
    you can use

    update replace input()/myelement//el_to_replace[. = “oldvalue”] with <el_to_replace>newvalue</el_to_replace>

    or better

    update
    for $i in input()/myelement//el_to_replace
    where $i eq “oldvalue”
    do replace $i with <el_to_replace>newvalue</el_to_replace>

    Best regards
    Walter


    #webMethods
    #Tamino
    #API-Management


  • 3.  RE: xquery

    Posted Wed May 14, 2003 08:02 PM

    Hello @nto, Hello Walter,

    here is an update query that I cooked up from both of your postings:

       declare namespace tf = "http://namespaces.softwareag.com/tamino/TaminoFunction"
    update 
    for $i in input()/d/*/text()
    where $i ne "hello"
    do replace $i with tf:createTextNode("newvalue")</pre><BR>I used a document which looked like this before the update:<BR><pre class="ip-ubbcode-code-pre">   <d>
    <a>ckdjfk</a>
    <b>hello</b>
    <c>bye</c>
    </d></pre><BR>After the update it was:<BR><pre class="ip-ubbcode-code-pre">   <d>
    <a>newvalue</a> 
    <b>hello</b>
    <c>newvalue</c> 
    </d>


    Greetings,
    Trevor.


    #webMethods
    #Tamino
    #API-Management