Copied to clipboard

Flag this post as spam?

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


  • BarneyHall 141 posts 210 karma points
    May 20, 2010 @ 13:55
    BarneyHall
    0

    List upcoming events outside calendar

    Hi Peter,

    I wanted to list upcoming events (for the coming week or month) outside the calendar on other pages.

    I created a macro from the XSLT you provided in this post http://our.umbraco.org/projects/pdcalendar/pdcalendar/3198-Start-and-End-Time

    However it doesn't seem to be working. Here's the code I lifted from that post (in it's entirety I'm afraid but better give you a full picture).

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:exslt="urn:Exslt.ExsltCommon"
        xmlns:date="urn:Exslt.ExsltDatesAndTimes"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:pdcalendar="urn:pdcalendar"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets pdcalendar date">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:variable name="messages" select="pdcalendar:GenerateDates(date:date(),date:add(date:date(),'P1M'),'Calendar')" />

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

        <ul>
            <xsl:for-each select="$messages/node">
                <xsl:if test="count(./event) &gt; 0">
                    <li>
                        <xsl:value-of select="@date"/>
                        <ul>
                            <xsl:for-each select="./event">
                                <li>
                                    <a href="{umbraco.library:NiceUrl(@id)}">
                                        <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/@nodeName"/>
                                    </a>
                                </li>
                            </xsl:for-each>
                        </ul>
                    </li>
                </xsl:if>
            </xsl:for-each>
        </ul>

    </xsl:template>

    </xsl:stylesheet>

    I have replaced "events" with my alias "Calendar" within GenerateDates().

    All I get when including this on a page is a huge list (roughly 3 months worths) of dates and no event nodes links.

    Any idea where I'm going wrong?

    Many thanks,
    Barney

  • BarneyHall 141 posts 210 karma points
    May 20, 2010 @ 13:59
    BarneyHall
    0

    Sorry just to clarify, I get a month's list of dates only if I remove the xsl:if condition but still no event node details.

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    May 20, 2010 @ 21:07
    Peter Dijksterhuis
    0

    Hi Barney,

    can you output <xsl:value-of select="date:date()"/> for me and tell me what the output is?

    Also, 'Calendar' is the alias of the documenttype that contains the pdcalendar datatype right? Is the casing correct?

    Peter

  • BarneyHall 141 posts 210 karma points
    May 20, 2010 @ 23:52
    BarneyHall
    0

    Hi Peter, cheers for looking at this for me.

    <xsl:value-of select="date:date()"/> outputs "2010-05-20" (without the "").

    And yes the casing is correct for the document type alias.

    Many thanks,
    Barney

  • BarneyHall 141 posts 210 karma points
    May 21, 2010 @ 16:45
    BarneyHall
    0

    Any word? Hate to hassle but have a client waiting and we did buy the pro version. Any help would be gratefully appreciated.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    May 21, 2010 @ 17:19
    Peter Dijksterhuis
    0

    Barney,

    I replicated the xslt on my machine and it works fine on my end.

    In order to investigate a bit more, is it possible to give me temporarily access to the backend of the site so I can look at the xslt, the document-type and the actual nodes?

    Regards,

    Peter

     

  • BarneyHall 141 posts 210 karma points
    May 22, 2010 @ 14:36
    BarneyHall
    0

    Got to say a big thank you to Peter for helping me out on this.

    Seems like it was that I was using "Calendar" as my document type alias where I should have kept it as "event" - a sympton of my brain being too slow for XSLT :)

    Thank you Peter. Very much oblidged.

  • 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