Copied to clipboard

Flag this post as spam?

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


  • Fourfinger 24 posts 44 karma points
    Mar 07, 2012 @ 13:14
    Fourfinger
    0

    XSLT and Sessions

    Hello,

     

    I'm trying to build a multilingual umbracosite. Ive decided not to go with the copy-per-language concept since it's a website that has to be the same for each language no exceptions.

    So I figured I'd save the language in the Session using a querystring.

    This is the one I run in my masterpage:

        <xsl:variable name="language">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('lang') =  ''">
          NL
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('lang')" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable> 

    <xsl:value-of select="$currentPage/*[ local-name() = concat('bodyText_',$language) ]" disable-output-escaping="yes" />

     

    So that works since I can call it up with another XSLT macro.

     

    Then I do the following when I call my bodyText_NL/DE/FR

        <xsl:variable name="language">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('lang') =  ''">
          NL
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('lang')" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:value-of select="$currentPage/*[ local-name() = concat('bodyText_',$language) ]" disable-output-escaping="yes" />

    Since i can't get under this code box, I'll type it in here..

    When I call this, it does not work. It does work when I put a language in the querystring as "?lang=NL", but not without, but I now it's there because an XSLT can show it on my page..

    Any help would be appreciated, as I'm going mental out of frustration -_-


    Thanks in advance..
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 07, 2012 @ 19:36
    Jan Skovgaard
    0

    Hi Fourfinger

    Is all your properties named like bodyText_NL, bodyText_UK etc.?

    And what happens if you try to get the value from the $lang variable? what does it look like? Does it contain "NL" or is it empty (when the querystring request is empty).

    If the variable is not empty perhaps try wrapping it in <xsl:text>NL</xsl:text> since it could perhaps be that some white-space is saved so the result when the querystring is empty would be like this:      NL and therefor in your concat will search for an element like this....bodyText_     NL...(Not sure though).

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft