Copied to clipboard

Flag this post as spam?

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


  • wildlife 54 posts 74 karma points
    Nov 03, 2010 @ 05:49
    wildlife
    0

    Adding XSLT conditional to PDCTableCalendar.xslt based on field data...

    I am working in Umbraco 4.0.3 and using the PDCalendar package.  We have event items as document types and those are getting displayed in a calendar using the PDCTableCalendar.xslt file. 

    The part of the code in that file that displays the event items in the calendar is as follows:

    <xsl:template name="createOneCell">
    <xsl:param name="cell"/>
    <td height="50"><div id="calendar-day"><xsl:value-of select="date:dayinmonth($cell/@date)"/></div><br/>
    <xsl:for-each select="$cell/event">
    <div id="smalltext">
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/@nodeName"/>
    </a>
    </div>
    </xsl:for-each>
    </td>
    </xsl:template>

     

    What I am trying to do here is to add a conditional that will limit the type of events that get displayed.  Within the Event Item document type, I have an EventType field where you can choose from Statewide, Regional and County events.  I want this particular calendar I'm setting up to only display the Regional events.  Can anyone tell me how to code this?

    I'm thinking I need to add the following:

    [string(data [@alias='eventType']) = 'Regional Event']

    on the for-each line, or to add another line with the following:

    <xsl:if test="@eventType='County Event'">
    </xsl:if>

    just to the inside of the for-each section, but everything I've tried is resulting in errors because I don't know the proper XSLT syntax to do this.  I'm trying to learn on the fly.  If I can get this for Regional Events, I'll use the same technique for the Statewide and County events calendars I'm also trying to set up.

     

     

  • wildlife 54 posts 74 karma points
    Nov 03, 2010 @ 06:28
    wildlife
    0

    Oops, meant to say

    <xsl:if test="@eventType='Regional Event'">
    </xsl:if>

    on that last section of code.

Please Sign in or register to post replies

Write your reply to:

Draft