Copied to clipboard

Flag this post as spam?

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


  • Ralph van Vugt 57 posts 101 karma points
    Aug 04, 2011 @ 14:23
    Ralph van Vugt
    0

    Combine strings?

    I have a multilangual website setup, in which the xslt checks for the current language by getting the name of the rootnode. It then has to append the current language to a property alias. I've tried to do it with concat, but it gives me text instead of a value.

    So, I have a $lang and a value for $node/prodDescription and I want the the complete string to be:

    <xsl:value-of select="$node/prodDescription_NL"/>

    Is that possible?

    Some explanation:

    <xsl:template match="/">
    
        <xsl:variable name="lang" select="$currentPage/ancestor-or-self::*[@level = '2']/@nodeName"/>
    
        <xsl:value-of select="$lang"/>
    
        <xsl:if test="$currentPage/products/MultiNodePicker/nodeId">
    
          <xsl:for-each select="$currentPage/products/MultiNodePicker/nodeId">
    
            <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />
    
            <div class="dealer">
              <h3>
                <xsl:value-of select="$node/pageTitle"/>
              </h3>
            </div>
          </xsl:for-each>
    
        </xsl:if>
    
      </xsl:template>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 04, 2011 @ 14:32
    Tom Fulton
    1

    You can use concat, you just need to do the following to access the field:

    <xsl:variable name="propertyAlias" select="concat('prodDescription_',$lang)"/>

    <xsl:value-of select="$node/* [not(@isDoc)][name() = $propertyAlias]"/>

    Not tested but should work..

    -Tom

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Aug 04, 2011 @ 14:34
    Chriztian Steinmeier
    0

    [EDIT]

    ... Too slow :-)

    /Chriztian

  • Ralph van Vugt 57 posts 101 karma points
    Aug 04, 2011 @ 14:38
    Ralph van Vugt
    0

    Tom and Chriztian,

    Exactly what I was looking for!

    Thanks!

    Ralph

  • 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