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

selecting unique values within seperate node lists

  • 1.  selecting unique values within seperate node lists

    Posted Wed April 23, 2003 09:14 PM

    Hello list,
    I have the following XML document:
    <?xml version="1.0" encoding="UTF-8"?>




    monthToDate
    100
    HPQ Enterprise
    Worldwide


    monthToDate
    200
    Enterprise Systems Group
    Worldwide


    yearToDate
    300
    HPQ Enterprise
    Worldwide


    yearToDate
    400
    Enterprise Systems Group
    Worldwide





    This is the Order Nugget Portlet Status text


    This is the Order Nugget Dynamic Message text


    This is the Order Nugget User Submitted text




    And I need to creat an HTML row from the elements, ie MonthToDate and YearToDate. The kicker is that MonthToDate and YearToData repeate between node sets–as you can see each occur twice–i just need them once to create a headin for an HTML table. Then I need to extract the product names along with the content. So the HTML would look like the following:
    MonthToDate YearToDate
    HPQ Enterprise 100 300
    Enterprise
    Systems Group 200 400
    Worldwide

    I have attached the stylesheet I have hacking around in. Many thanks
    Shane
    dataNuggetView2.xsl (3.07 KB)


    #webMethods
    #API-Management
    #Tamino


  • 2.  RE: selecting unique values within seperate node lists

    Posted Sat April 26, 2003 01:33 AM

    This is a standard grouping problem. There are two standard coding patterns for solving grouping problems in XSLT. The first (simple but not very efficient) is to use a construct like

    select=“name[not(.=…/preceding-sibling::*/name)]”

    which selects the name elements that don’t match the name in a previous record.

    For large data sets, a much more efficient approach is the so-called Muenchian grouping method, which is described in most XSLT textbooks, and also at http://www.jenitennison.com/xslt/grouping

    I hope this helps you.

    Michael Kay


    #Tamino
    #API-Management
    #webMethods


  • 3.  RE: selecting unique values within seperate node lists

    Posted Mon April 28, 2003 10:40 PM

    thanks for the info! the attached xsl seems to do the trick. you can apply it to the sample xml in my original post.
    dataNuggetView3.xsl (2.87 KB)


    #Tamino
    #webMethods
    #API-Management