Copied to clipboard

Flag this post as spam?

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


  • CodeMaster2008 151 posts 184 karma points
    Jun 25, 2010 @ 01:30
    CodeMaster2008
    0

    Recursive value won't work on macro

    I use to do it before but on this new site i can't get it to work.
    Here is the site tree:

    Content
    |- Site Content
    |- Home
    |- Page 1
    |- Page 2
    |- Folder 1

    Looks kind of ugly but the reason "the Site Content" node exist is that "Editors" can start from there, without access to the "Content" node.

    "Site Content" has it's "umbracoInternalRedirectId" set to the "Home" node id, so when users go to "domain.com" they endup on the "Home" node.

    "Home" has a property called "siteLogo" of type upload.

    Finally, the xslt i'm using to get the logo that is not working, it's always returns empty:

    <xsl:variable
    name="logo" select="$currentPage/ancestor-or-self::node[data[@alias =
    'siteLogo']][1]/data[@alias='siteLogo']"
    />

    However, if i use this inside a template a get the siteLogo value:

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

    The reason i'd like to get it from a macro is because i also will set the "alt" and "title" attributes conditionally.

  • CodeMaster2008 151 posts 184 karma points
    Jun 25, 2010 @ 02:45
    CodeMaster2008
    0

    Oi forgot to say i was using 4.1 RC.
    I made a few changes and got it working on all pages except from the "Home", no matter wich level i enter on "$minLevel", it will never appears on the home page.

    <xsl:variable name="minLevel" select="1"/>
    <xsl:variable name="logo" select="$currentPage/ancestor::* [@level >=
    $minLevel]/siteLogo "
    />

     

  • CodeMaster2008 151 posts 184 karma points
    Jun 25, 2010 @ 06:13
    CodeMaster2008
    0

    oh man, xslt is always a problem for me :-)
    This time i forgot to add "-or-self", now it's working like a charm:

    <xsl:variable name="minLevel" select="1"/>
    <xsl:variable name="logo" select="$currentPage/ancestor-or-self::* [@level >=
    $minLevel]/siteLogo "
    />

    Here a doc that helped me understand the new xslt schema:

    http://our.umbraco.org/wiki/reference/xslt/41-xml-schema/xslt-examples-updated-to-new-schema

  • 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