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

declare variable in xsl

  • 1.  declare variable in xsl

    Posted Mon February 14, 2005 10:15 AM

    may I know how do i assign a variable for the value selected below:
    example:
    <xsl:template match=“/”>
    <xsl:value-of select=“catalog/cd/title”/>
    </xsl:template>

    using xsl:param how do i retreive the variable and concatenate it together with another variable to form a new string? please kindly help!

    what is important is how to retrieve the variable such that i can fix that value into part of a URL?

    can anyone please help me? thank you so much!


    #Tamino
    #webMethods
    #API-Management


  • 2.  RE: declare variable in xsl

    Posted Mon February 14, 2005 11:34 AM

    Hello there,

    About xsl variable, there is an offside that you should be aware of : they are CONSTANT. That means that once you valued a variable it cannot be overwritten (counters are not available with xsl:variable). Overwriting is syntaxly possible (you won’t get any error, even at runtime) but it won’t work.

    Let’s get to code :


    <xsl:stylesheet version=“1.0” xmlns:xsl=“XSLT Namespace”>

    <xsl:param name=“baseWebapp” select=“http://myBigHOST/myWebapp”/>

    <xsl:template match=“/”>

    <xsl:variable name=“title” select=“catalog/cd/title” />

    <xsl:call-template name=“buildURL”>
    <xsl:with-param name=“baseURL” select=“$baseWebapp” />
    <xsl:with-param name=“title” select=“$title” />
    </xsl:call-template>

    </xsl:template>

    <xsl:template name=“buildURL”>
    <xsl:param name=“baseURL” />
    <xsl:param name=“title” />

    <xsl:value-of select=“$baseURL” />
    xsl:text?title=</xsl:text>
    <xsl:value-of select=“$title” />

    </xsl:template>

    </xsl:stylesheet>

    Is this snippet enough for you. Feel free to ask for more.

    Cheers

    Bertrand Martel
    Software AG France


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: declare variable in xsl

    Posted Tue February 15, 2005 01:34 AM

    Thanks Bertrand!

    Gemi


    #webMethods
    #API-Management
    #Tamino