Copied to clipboard

Flag this post as spam?

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


  • Phil Crowe 192 posts 256 karma points
    Feb 09, 2011 @ 11:27
    Phil Crowe
    0

    String Join in umbraco xslt

    is there any way of joining strings together in umbraco xslt? I tried this which i found in a google search but umbraco didnt seem to like it. 

    <xsl:variable name="newItem" select="string-join( ('a', 'b', 'c'), '')" />

    im trying to do the following:

    <xsl:variable name="test" select="1,2,3" />

    i want to be able to add another number to the end so its like 

    <xsl:variable name="test" select="1,2,3,4" />

    how can i do this?

  • Rich Green 2246 posts 4006 karma points
    Feb 09, 2011 @ 11:41
    Rich Green
    1

    Hey Phil,

    You can use concat

    <xsl:value-of select="concat('a', 'b', 'c')"/>

    More details http://www.xsltfunctions.com/xsl/fn_concat.html

    Rich

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Feb 09, 2011 @ 11:50
    Lee Kelleher
    0

    Hi Phil,

    In "pure" XSLT there isn't a string.Join equivalent.  As Rich says, if you're dealing with strings, then concat is the way to go.

    We do have an XSLT extension in uComponent 2.1 (beta) called "Concat" - this can take a nodeset and then join it together using a separator string/character.

    e.g.

    <xsl:value-of select="ucomponents.strings:Concat($currentPage/values/value, ',')" />

    Cheers, Lee.

  • Phil Crowe 192 posts 256 karma points
    Feb 09, 2011 @ 13:04
    Phil Crowe
    0

    thaks rich, thats just what i needed  :) The extension you are talking about lee does sound like it will suit me more. ill give this a try as well. thanks both.

  • 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