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.


#TechXchangePresenter
 View Only
  • 1.  max() : X-Query filtering using max() result

    Posted Fri July 04, 2003 05:50 PM

    Hello there.

    I am facing an issue with the max() function.
    My doctype looks like the following :



    Project666
    <…>


    2
    1
    0

    <…>


    OK, so i have numerous projects = XML documents inside Tamino. The same project (having same name) can be versionned : the xml document is cloned and version tags values modified accordingly.

    Anyway, what I want is to fetch the latest XML document which is the latest version.

    My X-Query is the following (it is simplified - ie only the latest major version)

    /project[common/name=‘Project666’][version/major=max(/project[common/name=‘Project666’]/version/major)]

    => give me ALL project666 documents.

    The following :

    max(/project[common/name=‘Project666’]/version/major)

    => give me

    xql:result3</xql:result>

    So I tried with hard-coded value (3 is the latest major version)

    /project[common/name=‘Project666’][version/major=3]

    => It gives me what I want : the latest major version xml document.

    I even have tried stuff like number(max(/…)), without success.

    So my point is, can you use the max() function inside a X-Query filter ?

    Thanks in advance.

    Bertrand Martel
    Software AG France


    #Tamino
    #API-Management
    #webMethods


  • 2.  RE: max() : X-Query filtering using max() result

    Posted Fri July 11, 2003 01:59 AM

    Hello Bertrand,

    I don’t know if this is helpful in your situation, but this works in Tamino 4.1 XQuery:

       let $maxMajor := max(input()/project[common/name='Project666']/version/major)
    for $project in input()/project
    where $project/common/name='Project666'
    and $project/version/major = $maxMajor
    return $project


    I hope that helps,
    Trevor.


    #API-Management
    #webMethods
    #Tamino


  • 3.  RE: max() : X-Query filtering using max() result

    Posted Fri July 11, 2003 10:07 AM

    Hello Bertrand,

    X-Query can’t do that since an absolute path in a filter is always interpreted as beginning from the current document and thus the expression provided as the input to max() yields the current major value only. So, yes, you can use max() in a filter but in your case to no avail. As Trevor pointed out you can use XQuery.

    Regards,
    Juliane.


    #webMethods
    #Tamino
    #API-Management


  • 4.  RE: max() : X-Query filtering using max() result

    Posted Fri July 11, 2003 11:54 AM

    Hello,

    Thank you very much for your answers. I have solved my problem inside an XSL template (with EXSLT max() function).
    Off course, this (should) take longer than using the max() function directly in the X-Query, but process time is satisfactory. So I’m OK with that.

    Ciao.

    Bertrand Martel
    Software AG France


    #Tamino
    #API-Management
    #webMethods