Copied to clipboard

Flag this post as spam?

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


  • Michael Falch Madsen 70 posts 92 karma points
    Oct 22, 2010 @ 17:36
    Michael Falch Madsen
    0

    if variable

    Know i used to PHP but can this be done with xslt?

    <xsl:variable name="imgFolder" select="$currentPage/thumbnailFolder"/>


      <xsl:if test="umbraco.library:RequestQueryString('id') &gt; 0">
        <xsl:variable name="imgFolder" select="umbraco.library:RequestQueryString('id')"/>
      </xsl:if>


    now i says The variable or parameter 'imgFolder' was duplicated within the same scope

  • Petr Snobelt 923 posts 1535 karma points
    Oct 22, 2010 @ 17:45
    Petr Snobelt
    1
    <xsl:variable name="myVar">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('id') &gt; 0">
          <xsl:value-of select="umbraco.library:RequestQueryString('id')"/>
        <xsl:otherwise>
          <xsl:value-of select="$currentPage/thumbnailFolder"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    Variables in xslt can't be changed, so you must chose right variable in initialization ....

    Petr

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 22, 2010 @ 17:46
    Jan Skovgaard
    0

    Hi Michael

    I guess you could solve it by using a choose like

    <xsl:variable name="imgFolder">

    <xsl:choose>

    <xsl:when test="umbraco.library:RequestQueryString('id') &gt; 0"><xsl:value-of select="umbraco.library:RequestQueryString('id'" /></xsl:when>

    <xsl:otherwise>
    <xsl:value-of select="$currentPage/thumbnailFolder" />
    </xsl:otherwise>

    </xsl:choose>

    </xsl:variabel>

    Hope this helps

    /Jan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 22, 2010 @ 17:46
    Jan Skovgaard
    0

    Arh, too slow :)

  • Michael Falch Madsen 70 posts 92 karma points
    Oct 22, 2010 @ 21:58
    Michael Falch Madsen
    0

    Super! it works great :)

Please Sign in or register to post replies

Write your reply to:

Draft