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.

 View Only
Expand all | Collapse all

XQuery to choose between attributes or none

  • 1.  XQuery to choose between attributes or none

    Posted Sat October 08, 2005 02:40 AM

    A rather tough problem is what I’m facing at this moment.

    We’ve got an element which has three forms of appearence.

    The last version is most commen, but, if there’s more elements then only one can be primairy.

    What I’m trying to do is build an xquery where I select both the element without an attribute and the element with the primairy value.

    for $a in input()/book
    return

    <for $b in input()/article where $b/@book = $a/@id return $b[@attribute=“primairy”]

    or

    for $a in input()/book
    return

    <for $b in input()/article where $b/@book = $a/@id return $b

    But somehow I would like to combine these two query’s.

    Using the [@attribute!=“secundairy”] only gives back primairy.


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: XQuery to choose between attributes or none

    Posted Mon October 10, 2005 09:20 AM

    Does this work for you?

    for $a in input()/book, $b in input()/article
    where $b/@book = $a/@id
    and $b/@attribute = “primairy”
    or not($b/@attribute)
    return $b


    #webMethods
    #Tamino
    #API-Management