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

Help required with XSLT transformation

  • 1.  Help required with XSLT transformation

    Posted Tue August 17, 2004 09:17 PM

    Hi there,
    I am a xslt newbie and I am working on a stylesheet to transform the following XML. Can someone please help me in getting such a stylesheet that outputs all the departments names with HP Inkjet printers?
    Thanks a lot.

    SOURCE XML:

    <?xml version="1.0" encoding="UTF-8"?>


    Help Desk


    HP
    Laser




    QA


    HP
    InkJet




    Finance


    HP
    InkJet




    HR


    HP
    Laser




    IT


    HP
    InkJet






    Want to get the following XML:

    <?xml version="1.0" encoding="UTF-8"?>

    <MESSAGE_BODY>










    </MESSAGE_BODY>


    The two key things that I


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: Help required with XSLT transformation

    Posted Wed August 18, 2004 11:43 AM

    Hi Rafael,

    the following stylesheet does the selection and the indexing.

    Regards,
    Juliane.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xsl:stylesheet xmlns:xsl=“XSLT Namespace
    version=“1.0”>

    <xsl:output method=“xml”/>

    <xsl:template match=“/”>

    <MESSAGE_BODY>
    <xsl:apply-templates select=“departments/dept[.//resource[printer and type = ‘InkJet’]]”/>
    </MESSAGE_BODY>

    </xsl:template>

    <xsl:template match=“dept”>

    <xsl:attribute name=“index”>
    <xsl:number value=“position() - 1”/>
    </xsl:attribute>

    </xsl:template>

    </xsl:stylesheet>


    #API-Management
    #webMethods
    #Tamino


  • 3.  RE: Help required with XSLT transformation

    Posted Wed August 18, 2004 05:22 PM

    Thanks a lot Juliane!!!

    Your help was very usefull, it worked great!!

    Rafael


    #webMethods
    #Tamino
    #API-Management