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.  Reference to Sibling of one node in XQuery?

    Posted Wed April 23, 2003 05:05 PM

    Hi,
    I need to reference a sibling of a node (actually I need an interval of 5 nodes before and 5 behind a certain node).
    In XSLT I used the preceding-sibling and following sibling, but in Tamino- XQuery this is not possible, at least as far as I know.
    Anyone having an idea for a workaround?


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: Reference to Sibling of one node in XQuery?

    Posted Sat April 26, 2003 01:14 AM

    Unfortunately XQuery offers only a subset of the XPath axes.

    You can get all the preceding sibling elements of a node $x using the XQuery expression

    $x/…/[.<<$x]

    and the following siblings as

    $x/…/
    [.>>$x]

    Michael Kay
    (I haven’t checked whether these work in Tamino 4.1)


    #Tamino
    #webMethods
    #API-Management


  • 3.  RE: Reference to Sibling of one node in XQuery?

    Posted Mon April 28, 2003 02:12 PM

    $x/…/[.>>$x] does not work with Tamino in result expressions (Probably not in other expressions as well) at least I cannot make it work.

    I tried to use the position statement:
    $x/…/
    [position()= 7], which works but of course I need to replace the number by something like “[position()=$x/position() + 1]”, i.e. depending on the position of the source node in the document tree, or even better as a rule “[position()< $x/position() +5 and position()>= $x/position()]”, defining the interval.

    But for both I cannot figure out
    a) if it is possible at all in Tamino XQUERY
    b) which is the correct syntax.

    Any ideas would be appreciated.


    #API-Management
    #webMethods
    #Tamino


  • 4.  RE: Reference to Sibling of one node in XQuery?

    Posted Mon April 28, 2003 02:15 PM

    No, both << and >> do not yet work in Tamino.

    Regards,
    Juliane.


    #Tamino
    #webMethods
    #API-Management


  • 5.  RE: Reference to Sibling of one node in XQuery?

    Posted Mon April 28, 2003 02:30 PM

    Yes, this is the other way I thought of. To use the position() function within a filter upon other nodes besides the current node. But Tamino only supports a limited syntax with path expressions, i.e. only the first step of a path might be something different from a location step. Thus expressions like $x/position() are prohibited position() being a function call and not a location step. So to my knowledge Tamino does currently not allow what you want to do. I am sorry, but you’ll have to wait. I guess we’ll allow a more general path syntax in the next release.

    Regards,
    Juliane.


    #API-Management
    #Tamino
    #webMethods