Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Mar 22, 2011 @ 23:15
    Biagio Paruolo
    0

    How to convert this in Razor?

    <xsl:param name="currentPage"/>

    <xsl:variable name="minLevel" select="1"/>

    <xsl:template match="/">

    <xsl:value-of select="$currentPage/ancestor-or-self::root/WebSiteSettings [@isDoc]/logo"/>

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 23, 2011 @ 08:16
    Sebastiaan Janssen
    0

    This should work:

    @Model.AncestorOrSelf("WebsiteSettings").Logo

    It looks up the tree and finds the first node with the NodeTypeAlias of WebsiteSettings and then takes the Logo value that's there.

  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Mar 23, 2011 @ 09:03
    Biagio Paruolo
    0

    Don't work. I've NULL error. WebSiteSetting node is a sibling of "it" node ( child of default CONTENT node ).

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 23, 2011 @ 09:17
    Sebastiaan Janssen
    0

    Are you sure the logo has a value?

    How about:

    @Model.AncestorOrSelf().DescendantsOrSelf("WebsiteSettings").First().Logo
  • Biagio Paruolo 1494 posts 1635 karma points c-trib
    Mar 24, 2011 @ 10:41
    Biagio Paruolo
    0

    This in XSLT works:

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <xsl:value-of select="$currentPage/ancestor-or-self::root/WebSiteSettings [@isDoc]/logo"/>

    </xsl:template>


    Razor script no. I've error null or empty value.

  • Yannick Smits 321 posts 718 karma points
    Mar 26, 2011 @ 22:21
    Yannick Smits
    0

    Here is the cheaty way:

    @Model.XPath("//WebSiteSettings [@isDoc]").First().logo

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 28, 2011 @ 08:00
    Sebastiaan Janssen
    0

    Looks like I just got the casing wrong: WebSiteSettings != WebsiteSettings. So the code should be:

    @Model.AncesterOrSelft("WebSiteSettings").First().logo
  • 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