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
  • 1.  XQuery > Counting preceding nodes

    Posted Fri August 05, 2005 12:37 PM

    Hello there,

    As Tamino’s XQuery implementation is missing the preceding reverse Axis, I was wondering if there was any way to perform the following task.

    Let’s say I have this XML document :

    001 002 019 020

    Chapter are recursive and can contain any number of terminal Article nodes.

    What I want to do is to select an article from its id (eg “020”), and count how many preceding Article nodes I have (eg 19). That is its position among all other Articles.

    Axis preceding::Article, would be great, but it is not implemented yet.

    I developped an SXS to count Article using SAX, but this messes my Tamino DB’s memory (Memory Allocation Failed).

    Any ideas ?

    Thanks in advance.


    #Tamino
    #webMethods
    #API-Management


  • 2.  RE: XQuery > Counting preceding nodes

    Posted Mon August 22, 2005 09:52 AM

    Hi,

    I have to admit that the preceding axis is not supported by Tamino XQuery. This is due to the fact that the preceding axis is optional. Moreover I’m afraid that there is no other way to express the preceding axis with Tamino 4.2 (except writing an sxs function). The good news is that the upcoming Tamino version will support order comparisons which allow you to count the predecessors of a given node.

    Best Regards,

    Thorsten Fiebig


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: XQuery > Counting preceding nodes

    Posted Tue August 23, 2005 02:47 PM

    Hi,

    if your Article-IDs are really sorted as your sample suggests, it is
    possible with:

    let $root := …
    let $article := $root//Article[.=“020”]
    return count($root//Article[. < $article])

    Regards,
    Juliane.


    #Tamino
    #API-Management
    #webMethods


  • 4.  RE: XQuery > Counting preceding nodes

    Posted Tue August 23, 2005 03:08 PM

    Thanks for you replies.

    Unfortunately my ids are not sorted (these are dynamically generated ids). Indeed they are in my example, but that was for simplicity sake.

    Cheers


    #API-Management
    #webMethods
    #Tamino