Copied to clipboard

Flag this post as spam?

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


  • Kim Hansen 63 posts 144 karma points
    Jun 14, 2011 @ 14:45
    Kim Hansen
    0

    Multiple variables in select

    Hi guys

    Im about to update a Umbraco 4.0 to 4.7 on a 3rd party solution and ive encountered some select problems.

    For unknown reasons the developer have made a tab for each language and then gave the nodes different names (eg. PageName, PageName_en and PageName_de)

     

    concat('PageName', $flang) outputs PageName_de

     

    Using a concat i can get the right nodename, but i cant get it to select the right data.

    I would like to make a select statement like

     

    <xsl:variable name="pageName">

    <xsl:value-of select="$parent[concat('PageName', $flang)]"/>

    </xsl:variable>

    <xsl:value-of select="$parent/$pageName"/>

    But XSL does not like two variables placed like that.

    How do i fix it?

    Thanks

    Kim

     

     

     

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 14, 2011 @ 21:52
    Lee Kelleher
    0

    Hi Kim,

    The XPath expression can not evaluate the variable's value as a node-set, so instead you need to do something like this...

    <xsl:value-of select="$parent/*[name() = concat('PageName', $flang)]" />

    Cheers, Lee.

  • Kim Hansen 63 posts 144 karma points
    Jun 21, 2011 @ 15:27
    Kim Hansen
    0

    Ah, perfect

    Thank you :)

Please Sign in or register to post replies

Write your reply to:

Draft