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
Expand all | Collapse all

simple XSLT transformation problem, please help

  • 1.  simple XSLT transformation problem, please help

    Posted Thu July 29, 2004 08:49 PM

    Hi I am a xslt beginner and I am working on a stylesheet to output a dept. Can someone help me in writing a stylesheet that outputs all the dept names with Lee AND Ray as managers given the simple xml below?
    (so for this example, it would output help desk). Thanks a lot.


    <?xml version="1.0" ?>


    Help Desk

    Lee
    Ray



    QA

    Lee
    Hoods



    Finance

    Ray



    #Tamino
    #webMethods
    #API-Management


  • 2.  RE: simple XSLT transformation problem, please help

    Posted Fri July 30, 2004 11:51 AM

    In XSLT you can use XPath expressions to select nodes to be processed. The example shown below will select only ‘dept’ nodes where the managers names are “Ray” and “Lee”.

      
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version="1.0">
    
    <xsl:template match="/">
    <xsl:apply-templates select="departments/dept[manager/name='Ray' and manager/name='Lee']"/>
    </xsl:template>
    
    
    <xsl:template match="dept">
    The department is <xsl:value-of select="name"/>
    </xsl:template>
    
    </xsl:stylesheet>



    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #API-Management
    #Tamino
    #webMethods