Copied to clipboard

Flag this post as spam?

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


  • praveity 100 posts 125 karma points
    Jun 03, 2011 @ 08:01
    praveity
    0

    Get value-of property using concat

    Hi to all,

    I am trying to get the value of the property using  concat in the xslt.

    E.g the alias name of the property is bodyText

    so i would like to have something like,

    <xsl:value-of select="$currentPage/concat('body','Text')" />

    on the previous schema we could do this nicely like

    <xsl:value-of select="$currentPage/data [@alias=concat('body','Text')]"/>

     

    Can't I try this out??

     

  • praveity 100 posts 125 karma points
    Jun 03, 2011 @ 10:40
    praveity
    1

    After a cumbersome trying, I finally found out the solution

    we could use following syntax

    <xsl:value-of select="$currentPage/*[ local-name() = concat('body','Text') ]"/>

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jun 05, 2011 @ 22:21
    Chriztian Steinmeier
    0

    Hi praveity,

    Maybe we should mention that the reason you would sometimes need this, is because you've got one (or all) part(s) of the resulting property name in a variable?

    <xsl:value-of select="$currentPage/*[name() = concat('image', $number, 'Media')]" />

    (Using name() is as good as local-name() as long as we're not using namespaced XML - which we're not in the Umbraco tree)

    Otherwise, it just doesn't make any sense to do this, and the haters will point and say: "Oh look how stupidly verbose XSLT is!" :-)  

    /Chriztian

  • praveity 100 posts 125 karma points
    Jun 06, 2011 @ 14:14
    praveity
    0

    You are right Chriztian,,

    I just gave a dummy example for forum post. Actually, I am using it for the getting the properties that have the common part and the remaining is the appended text (which seperates the properties for multilanguage according to session value that holds language parameter).

    I just made it look simple so that everyone could understand the scenario.

Please Sign in or register to post replies

Write your reply to:

Draft