1

I am trying to create an xsl template for displaying a calendar and am having an issue pulling the event date out of the calendar items.

Here is what I have:

<xsl:template name="DateCustomStyle" match="Row[@Style='DateCustomStyle']" mode="itemstyle">
<xsl:variable name="day" select="ddwrt:FormatDateTime(string(@Created),1033,'dd')" />
<xsl:if test="count(preceding-sibling::*)=0">
<h3 class="thisweek-title">This Week</h3>
</xsl:if>
    <div class="thisweek-item">
                <div class="thisweek-date">
                    <span class="thisweek-abbr">
                            <xsl:value-of select="ddwrt:FormatDateTime(string(@EventDate),1033,'ddd')"/>
                    </span>
            <span class="thisweek-day">
                            <xsl:value-of select="ddwrt:FormatDateTime(string(@EventDate),1033,'dd')"/>
                    </span>
                </div>
                <div class="thisweek-events">
                        <ul>
                            <li>
                    <span>
                            <xsl:value-of select="@Title"/></span>
                </li>
                        </ul>

                </div>
        </div>
<xsl:if test="count(following-sibling::*)=0">
<div class="thisweek-opencalendar"><a href="/Lists/Calendar">Open Calendar</a></div>
</xsl:if>
</xsl:template>

For some reason, the EventDate (which is the internal field name for Start Time) is empty. I have tested it with Created to make sure it was parsing correctly, which it is.

I am at a complete loss. I know for a fact that the date is in there, but its just not coming through.

Note

I have also replaced EventDate with Start_x0020_Time, which is the display name of the field. Also yielded nothing.

If anyone has a suggestion I would be grateful

Thanks.

1

Just to make sure, did you add the reference for the date-formats in the top in the ItemStyle.xsl file?

xmlns:ddwrt=http://schemas.microsoft.com/WebParts/v2/DataView/runtime

And this is how i'm using the EventDate in our SharePoint. I think the problem is that you are trying to convert the date into a string. Try to remove that and try this instead.

<span class="thisweek-day">
                        <xsl:value-of select="ddwrt:FormatDateTime(@EventDate, 1033, 'dd')"/>
                </span>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.