Copied to clipboard

Flag this post as spam?

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


  • mparril 4 posts 24 karma points
    Sep 27, 2011 @ 17:44
    mparril
    0

    PDCalendar - Get property values by alias from calendar events

    Hello guys, 

    I'm trying to display a list of events from the calendar on my home page. I can get the date and link no problem by using this script I found on this forum:

    <?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'),'event')" />
    <xsl:variable name="location" select="data[@alias='location']" />
    <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="umbraco.library:FormatDateTime(@date, 'MMMM, d')"/>
                              
                        <ul>
                            <xsl:for-each select="./event">
                                
                                    <href="{umbraco.library:NiceUrl(@id)}">
                                        <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/@nodeName"/>
                                    </a>
                            
                             
                              <xsl:value-of select="umbraco.library:GetPropertyTypeName(name(.), 'location')" />
                            </xsl:for-each>
                        </ul>
                    </li>
                </xsl:if>
            </xsl:for-each>
        </ul>

    </xsl:template>

    </xsl:stylesheet>

    For every event I have I have create a properties: Location, Time, etc. I've tried to pull these on to the home page, but have failed to do so.
    Has anybody succeeded in this? Or can somebody point in the right direction as far as what I'll need to do to access these values for each event listing?

    I'm very new to xslt and I am a bit lost. 

    Any help is appreciated!

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft