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

    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">
                <xsl:value-of select="$node/pageTitle"/>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 04, 2011 @ 14:32
    Tom Fulton

    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..


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


    ... Too slow :-)


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

    Tom and Chriztian,

    Exactly what I was looking for!



Please Sign in or register to post replies

Write your reply to: