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
    Jan 15, 2011 @ 09:06
    wildlife
    0

    Filtering different event types in XSLT?

    I wanted to see if anyone could help me with setting up an XSLT line to add to the PDCTableCalendar.xslt file that would be a conditional test that would allow me to filter the events that get displayed by the contents of another field within the node.

    We have three different event types:  Statewide, Regional, and County.  In all events, there is a field called Event Type with an alias of eventType that is a dropdown selection that allows the node author to define what type of event it should be.

    What I'd like to do right now is to set up a Statewide Events calendar that will only show events designated as Statewide Events, a Regional Events calendar that will only show events designated as Regional Events and a County Events calendar that will only show events designated as County.

    The section of code that controls this output is currently set up as:

    <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 need is the additional code needed to only display the events that I want.  I'll set up a different XSLT file for all three events.  That way, wherever I want a Regional Events calendar to display, I can call the PDCTableCalendar-regional.xslt file and when I want a County Events calendar to display, I can call the PDCTableCalendar-county.xslt file.

    The problem is everything I have tried to create this conditional hasn't worked.  It will either show all events or no events.  I have tried to test if the field EQUALS 'Statewide Event' 'Regional Event' or 'County Event' and I've also tried to test if the field CONTAINS those.  Neither approach produced the desired results, but it is very possible that my syntax wasn't correct.  I'm unclear on exactly how to do the test on the Umbraco node field name or alias name.  If anyone can provide the line(s) of code I'd need to accomplish this test, if this is doable, I'd appreciate it.

    After I get this working, I will probably have an additional question relating to filtering things further.  What I'll also want to do is have calendars on the county subpages, for example, that will only show County Events for that specific county so I'll need to figure out how to add that additional test as well, but should be able to emulate the approach used to solve this initial problem to accomplish that.  What I'm setting up here is calendars on the main Statewide, Regional and County pages that will display all events of the corresponding event type. 

Please Sign in or register to post replies

Write your reply to:

Draft