Copied to clipboard

Flag this post as spam?

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


  • Gísli Freyr Svavarsson 43 posts 126 karma points
    Apr 04, 2012 @ 15:38
    Gísli Freyr Svavarsson
    0

    Generic porperties displays with node

    hi, i'm building this website with umbraco and xslt. 

    when i use the GetXmlNodeById to display the node i want, it also displays values of properties within the node in the end of the node. 

    how can i prevent the value to be displayed. 

    br. 

    Gisli

     

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Apr 05, 2012 @ 00:23
    Chriztian Steinmeier
    0

    Hi Gisli,

    use a variable to grab the node, then pick whichever value you want to display:

    <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(XXXX)" />
    
    <!-- Output name of node -->
    <xsl:value-of select="$node/@nodeName" />
    
    <!-- Output any property by name, e.g. 'shoeSize' -->
    <xsl:value-of select="$node/shoeSize" />

     

    /Chriztian

  • Gísli Freyr Svavarsson 43 posts 126 karma points
    Apr 05, 2012 @ 13:30
    Gísli Freyr Svavarsson
    0

    Thanks Chriztian, 

    i tried this: 

    <xsl:variablename="rentalCar"select="umbraco.library:GetXmlNodeById(XXXX)"/>

    <xsl:value-of select="$rentalCar/@bodyText" disable-output-escaping="yes" />

    where the content i want displayed is the value of the bodyText property, this however doesn't return anything. 

    with only the variable name it displays the content but also displays the extra content i don't want to be displayed. 

    do you guys see any reason why this shouldn't work?

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Apr 06, 2012 @ 20:02
    Chriztian Steinmeier
    0

    Hi Gisli,

    Properties prefixed with an at-sign (@) are the built-in Umbraco properties (e.g., @nodeName, @createdDate esc.) whereas the ones you create yourself are created as children in the XML and thus don't use an at sign, so you should just write bodyText in your example above:

    <xsl:value-of select="$rentalCar/bodyText" />

    /Chriztian

  • Gísli Freyr Svavarsson 43 posts 126 karma points
    Apr 10, 2012 @ 10:52
    Gísli Freyr Svavarsson
    0

    thanks a million Chriztian. works perfectly 

Please Sign in or register to post replies

Write your reply to:

Draft