Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paulo Paiva 7 posts 28 karma points
    May 20, 2010 @ 12:04
    Paulo Paiva
    0

    Return Value from a Template

    Hello!

    Is it possible to pass the return value of a template call to a variable?

    Something like this:

    <xsl:template match="/">
      <xsl:variable name="ReturnValue">
          <xsl:call-template name="DoSamething">
                     <xsl:with-param name="Param1" select="'Hello '"/>
              <xsl:with-param name="Param2" select="'World'"/>
           </xsl:call-template>
      </xsl:variable>
    
      <xsl:choose>
      <xsl:when test="$ReturnValue = ''">
          <xsl:value-of select="'Return Empty'"/>
      </xsl:when>
      <xsl:otherwise>
          <xsl:value-of select="$ReturnValue" />
      </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    
    <xsl:template name="DoSamething">
      <xsl:param name="Param1" select="."/>
      <xsl:param name="Param2" select="."/>
    
    <xsl:value-of select="concat($Param1, $Param2)" /> </xsl:template>

     

    I want to test if the "call-template" return anything.

    Thanks

    Paulo

     

     

     

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    May 20, 2010 @ 12:36
    Lee Kelleher
    0

    Hi Paulo, not too sure what you are trying to achieve - guessing that it's not string concatenation?  From looking at your XSLT, it should work, can't see any immediate problems with it.

    Cheers, Lee.

  • Paulo Paiva 7 posts 28 karma points
    May 20, 2010 @ 13:02
    Paulo Paiva
    1

    You are right.... There is nothing wrong with this. The problem that I had was in another place in the code...

    Thanks.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies