Copied to clipboard

Flag this post as spam?

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


  • anthony hall 222 posts 536 karma points
    Aug 25, 2009 @ 13:28
    anthony hall
    0

    Get recursive value in marco

    i have a content picker property 'imageFront' that i wish to retrive in my xslt. I wish to choose the closest ancestor

    ie so this works as page field

    <umbraco:Item field="imageFront" recursive="true" runat="server"></umbraco:Item> // 1401

    How would i get this value '1401' into my macro. I heard you can use #. Where would this live

    My XSLT macro

    <umbraco:Macro propertyAlias="imageFront" altText="alt" imageWidth="400" imageHeight="400" Alias="Image" runat="server"></umbraco:Macro

    I've also tried just looking up by ancestor, but it's empty. 

    <xsl:variable name="myImage" select="$currentPage/ancestor-or-self::node [@alias = '$propertyAlias']" />

    <xsl:value-of select="$myImage"/> // empty


     

     

     

  • Daniel Lindstrom 454 posts 271 karma points
    Aug 25, 2009 @ 13:33
    Daniel Lindstrom
    0

    Neehouse wrote a great text on how to access properties recursively from within XSLT, on the old forum:

    http://forum.umbraco.org/yaf_postst2751_XSLT-Tip--Display-a-field-recursively.aspx

  • Daniel Lindstrom 454 posts 271 karma points
    Aug 25, 2009 @ 13:35
    Daniel Lindstrom
    102

    And you could also use a dollar sign instead of # in the macro call, se here:

    http://umbraco.org/23904

  • Daniel Lindstrom 454 posts 271 karma points
    Aug 25, 2009 @ 13:36
    Daniel Lindstrom
    2

    Example:

    <umbraco:macro alias="RenderProperties" pagevalue="[#bodyText]" runat="server"/>

    Syntax:

    Insert page value: [#propertyAlias]

    Insert recursive page value: [$propertyAlias]

    Insert cookie value: [%cokieValueKey]

    Insert value from request collection: [@requestValueKey]

  • anthony hall 222 posts 536 karma points
    Aug 25, 2009 @ 13:40
    anthony hall
    0

    thanks Daniel, really speedy response. Posted and fixed in 5mins. 

    <umbraco:Macro propertyAlias="[$imageFront]" altText="alt" imageWidth="400" imageHeight="400" Alias="Image" runat="server"></umbraco:Macro

Please Sign in or register to post replies

Write your reply to:

Draft