Thought I had it solved, but it isn't working correctly.
Background:
XSL 1.0...client-side transformation
Goal:
Sort data by date ascending. Select items from XML by program, type of event, and those dates greater than or equal to today's date. Display first item from that which has a value greater than or equal to today's date. There will be multiple dates after today's date and I only want the first instance.(There will also be multiple programs that may have events on the same date as other programs too.)
What I have so far:
[u]
Sample XML</u>
Code:
<event>
<type>meeting</type>
<evname>Executive Committee Meeting</evname>
<evdate>20081217</evdate>
<evstart>6:30pm</evstart>
<evend>9:30pm</evend>
<location>Large Conference Room</location>
<locmap></locmap>
<program id="board">Board of Directors</program>
<contact>Secretary</contact>
<email>secretary#64;ourorg.org</email>
<notes>Dinner is served at 6pm.</notes>
<siteurl></siteurl>
<postdate></postdate>
</event>
[u]
Sample XSL</u>
Code:
<xsl:template match="/">
<xsl:for-each select="//calendar/event/program[@id=$project]">
<xsl:sort select="../evdate" order="ascending" data-type="number"/>
<xsl:if test="../type ='meeting'">
<xsl:if test="../evdate >= $today and position() = 1">
<xsl:element name="h1">
<xsl:attribute name="class">side</xsl:attribute>
UPCOMING MEETING
</xsl:element>
<xsl:element name="ul">
<xsl:attribute name="class">sbox</xsl:attribute>
<xsl:element name="li">
<xsl:element name="b">
<xsl:attribute name="style">color: #a77909</xsl:attribute>
<xsl:value-of select="../eventdate"/> :: <xsl:value-of select="../eventstart"/>-<xsl:value-of select="../eventend"/> ::
</xsl:element><xsl:value-of select="../eventname"/> at <xsl:value-of select="../location"/>#160;
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
It outputs fine unless I have dates in the XML that are earlier than today's date as well as later ones. If that happens, I get nothing. Can anyone help me? Thanks.