Copied to clipboard

Flag this post as spam?

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


  • adam 4 posts 25 karma points
    Oct 19, 2011 @ 16:31
    adam
    0

    old schema -> new schema XSLT problem

    hi,

    I am using calendar XSLT macro from Business Website Starter Pack. I modified eventsArea macro so the calendar is stand alone macro now. It is used in main events area where it displays all events fine. Problem is that it is also used when individual event is browsed - I want all the events to be displayed as well but calendar displays only browsed event. I had it working fine in Umbraco 4.0.2 but I had to rewrite macros when upgraded to 4.7.1 and new schema so I guess I had to make mistake somewhere.

    I think that line where it fails is:

    <xsl:variable name="eventsToday" select="count($currentPage//ancestor-or-self::* [@isDoc and Exslt.ExsltStrings:lowercase($currentDate) = Exslt.ExsltStrings:lowercase(umbraco.library:FormatDateTime(./eventStartDateTime, 'MMMM d, yyyy'))])" />

    before upgrade I had it working fine with this line:

    <xsl:variable name="eventsToday" select="count($currentPage/ancestor-or-self::node//node [@nodeTypeAlias='Event' and Exslt.ExsltStrings:lowercase($currentDate) = Exslt.ExsltStrings:lowercase(umbraco.library:FormatDateTime(data [@alias='eventStartDateTime'], 'MMMM d, yyyy'))])" />

     

    I have tried:

    <xsl:variable name="eventsToday"  select="count($currentPage//ancestor-or-self::Event [(@isDoc and name()='Event') and Exslt.ExsltStrings:lowercase($currentDate) =  Exslt.ExsltStrings:lowercase(umbraco.library:FormatDateTime(./eventStartDateTime, 'MMMM d, yyyy'))])" />
            

    or

    <xsl:variable name="eventsToday"  select="count($currentPage//ancestor-or-self::* [(@isDoc and name()='Event') and Exslt.ExsltStrings:lowercase($currentDate) =  Exslt.ExsltStrings:lowercase(umbraco.library:FormatDateTime(./eventStartDateTime, 'MMMM d, yyyy'))])" />
                         

    but none of these work. Any help/hint is appreciated :)

  • Rich Green 2246 posts 4008 karma points
    Oct 19, 2011 @ 18:17
    Rich Green
    0

    Hi,

    I'm not sure why you've added the './' in ./eventStartDateTime, I think it should just be 'eventStartDateTime' otherwise you are going up the tree a level.

    Rich

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Oct 19, 2011 @ 23:52
    Chriztian Steinmeier
    0

    Hi Adam,

    Try to break it down in to manageable chunks, so it's easier to see what's going on:

    <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    <xsl:variable name="eventsRoot" select="$siteRoot/*[@nodeName = 'Calendar']" /><!-- Select appropriate node here -->
    <xsl:variable name="events" select="$eventsRoot//Event" />
    <xsl:variable name="currentDateLower" select="Exslt.ExsltStrings:lowercase($currentDate)" />
    <!-- ... -->
    <xsl:variable name="eventsToday" select="$events[umbraco.library:FormatDateTime(eventStartDateTime, 'MMMM d yyyy') = $currentDateLower]" />

    This way, you can always do a <xsl:copy-of /> at each step and see if the variable holds what you'd expect it to.

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft