Copied to clipboard

Flag this post as spam?

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


  • Max Mumford 266 posts 293 karma points
    Jan 12, 2011 @ 14:18
    Max Mumford
    0

    XSLT not rendering any content

    here is the xslt:

    <title>

    <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc][not(string(./PageTitle)='')]">

    <xsl:sort select="position()" data-type="number" order="descending"/>

    <xsl:if test="position()=1">

    <xsl:value-of select="./PageTitle" />

    </xsl:if>

    </xsl:for-each>

    </title>

    It basically loops through all ancestor and self node and looks for a parameter PageTitle that != "" to set as the title for the current node. However when running it, it does not return any data. 

    I am using Umbraco 4.5.1. Not sure if I am using the old or new schema; I think a whole bunch of xslt with the old schema is cached which is why some of it still works and some requires the new schema... 

    Any help would be appreciated :)

    Thanks,

    Max.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 12, 2011 @ 14:23
    Chriztian Steinmeier
    0

    Hi Max,

    Looks like you're aiming for the "recursive" functionality - you can get that in a single select:

    <xsl:value-of select="$currentPage/ancestor-or-self::*[not(pageTitle = '')][1]/pageTitle" />

    /Chriztian

     

  • Max Mumford 266 posts 293 karma points
    Jan 12, 2011 @ 14:32
    Max Mumford
    0

    Thanks; that's much cleaner. It validates fine but still dosn't output any data. 

    For our home page doc type, the Page Title attribute has an alias of "PageTitle" (first letter is capitalized). I inherited this site from another designer and it was running on a Very old version of Umbraco. since then I have upgraded it to 4.5.1. Is it possible that, for some reason, the data is not being rendered properly because umbraco prefers alias's with a lower case first letter?

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 12, 2011 @ 14:38
    Chriztian Steinmeier
    1

    Hi Max,

    No - that was my mistake (old habits die hard :-)

    If it doesn't work with the capitalized version, try the old schema version here:

    <xsl:value-of select="$currentPage/ancestor-or-self::node[normalize-space(data[@alias = 'PageTitle'])][1]/data[@alias = 'PageTitle']" />
    

    /Chriztian

  • Max Mumford 266 posts 293 karma points
    Jan 12, 2011 @ 14:40
    Max Mumford
    0

    Yep, that did it :)

    Thanks very much.

Please Sign in or register to post replies

Write your reply to:

Draft