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

Resolve XPaths sent as parameters

  • 1.  Resolve XPaths sent as parameters

    Posted Fri December 03, 2004 12:03 PM

    I’m trying to resolve a parameter into a valid XPath, so that I can use xsl:for-each with it. Here is the code:

    <xsl:call-template name=“PrintQuoteCompGridRow”>
    <xsl:with-param name=“Heading”>Quote Ref.:</xsl:with-param>
    <xsl:with-param name=“XPath”>/Message/Body/Risk[@Type=‘Quote’]</xsl:with-param>
    <xsl:with-param name=“Field”>@QuoteSeqNo</xsl:with-param>
    </xsl:call-template>


    <xsl:template name=“PrintQuoteCompGridRow”>
    <xsl:param name=“Heading”/>
    <xsl:param name=“XPath” select=“null”/>
    <xsl:param name=“Field”/>



    <xsl:value-of select=“$Heading”/>



    <xsl:for-each select=“ms:node-set($XPath)”>


    <xsl:value-of select=“ms:node-set($Field)”/>



    </xsl:for-each>

    </xsl:template>

    However, the output doesn’t loop through the $XPath sent (which is a valid XPath).

    Any ideas as to how I can resolve this?

    Robin


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: Resolve XPaths sent as parameters

    Posted Wed December 08, 2004 06:39 PM

    Hello there,

    Resolving an XPath expression from a variable/parameter is possible using the extension function evaluate().

    Depending on your XSLT engine you may choose the right option :

    . MSXML :

    There is no standard to perform such thing, you need to use an extension code. Please refer to
    this page.

    . Xalan (and maybe Saxon) :

    Use EXSLT function evaluate(). See this page.

    Hope this help.

    Bertrand Martel
    Software AG France


    #webMethods
    #API-Management
    #Tamino