I guess I can solve this by creating an xslt-template for upcoming conferences and another xslt-template for past conferences. But I don't know how to do this.
Firstly, your for loops are slightly different....the second one missing a location and summary, so if you want them pretty much the same, then you should use a template. Even so, if you want it different, you could put it all in a template, then put an <xsl:if around the specific parts.
Here is what I've come up with. This is untested, so see how you go.
Thanks a lot, I solved my problem by creating two two xslt-files, one looping through the upcoming conference nodes and one looping through the past conference nodes. Then on my template I implemented two macro's.
But you solution is so much more elegant. I learnt a great new thing about Xslt and using the <apply-templates mode="...."> element.
problem with xslt
Hi,
I have this xslt script that orders conference items under the headings 'upcoming conferences' and 'past conferences'.
But the result is not exactly what I hoped for because the headings are repeated for every conference item.
This is the script:
<xsl:for-each select="$currentPage/* [(name() = $documentTypeAlias and string(umbracoNaviHide) != '1') and umbraco.library:DateGreaterThanOrEqualToday(conferenceStartDate)]">
<a name="upcoming"> </a>
<h2>Upcoming conferences</h2>
<h3><xsl:value-of select="conferenceTitle"/></h3>
<xsl:if test="string-length(conferenceImage) > 0">
<img src="{umbraco.library:GetMedia(conferenceImage, false())/umbracoFile}" alt="{lectureTitle}" />
</xsl:if>
<p class="theme"><xsl:value-of select="conferenceTheme"/></p>
<p>
<xsl:choose>
<xsl:when test="conferenceEndDate != ''">
<xsl:if test="conferenceStartDate != ''">
<strong>Date:</strong> from <xsl:value-of select="umbraco.library:FormatDateTime(conferenceStartDate, 'dd/MM/yyyy')"/>
to <xsl:value-of select="umbraco.library:FormatDateTime(conferenceEndDate, 'dd/MM/yyyy')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="conferenceStartDate != ''">
<strong>Date:</strong> <xsl:value-of select="umbraco.library:FormatDateTime(conferenceStartDate, 'dd/MM/yyyy')"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:for-each>
<xsl:for-each select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1' and not(umbraco.library:DateGreaterThanOrEqualToday(conferenceStartDate))]">
<a name="past"> </a>
<h2>Past conferences</h2>
<h3><xsl:value-of select="conferenceTitle"/></h3>
<xsl:if test="string-length(conferenceImage) > 0">
<img src="{umbraco.library:GetMedia(conferenceImage, false())/umbracoFile}" alt="{lectureTitle}" />
</xsl:if>
<p class="theme"><xsl:value-of select="conferenceTheme"/></p>
<p>
<xsl:choose>
<xsl:when test="conferenceEndDate != ''">
<xsl:if test="conferenceStartDate != ''">
<strong>Date:</strong> from <xsl:value-of select="umbraco.library:FormatDateTime(conferenceStartDate, 'dd/MM/yyyy')"/>
to <xsl:value-of select="umbraco.library:FormatDateTime(conferenceEndDate, 'dd/MM/yyyy')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="conferenceStartDate != ''">
<strong>Date:</strong> <xsl:value-of select="umbraco.library:FormatDateTime(conferenceStartDate, 'dd/MM/yyyy')"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length(conferenceLocation) > 0">
- <xsl:value-of select="conferenceLocation"/>
</xsl:if>
</p>
<p><xsl:value-of select="conferenceSummary"/></p>
<p><a href="{umbraco.library:NiceUrl(@id)}" class="tekst">More information</a></p>
</xsl:for-each>
I guess I can solve this by creating an xslt-template for upcoming conferences and another xslt-template for past conferences. But I don't know how to do this.
Can someone help me?
Thanks,
Anthony Candaele
Firstly, your for loops are slightly different....the second one missing a location and summary, so if you want them pretty much the same, then you should use a template. Even so, if you want it different, you could put it all in a template, then put an <xsl:if around the specific parts.
Here is what I've come up with. This is untested, so see how you go.
Hi Sean,
Thanks a lot, I solved my problem by creating two two xslt-files, one looping through the upcoming conference nodes and one looping through the past conference nodes. Then on my template I implemented two macro's.
But you solution is so much more elegant. I learnt a great new thing about Xslt and using the <apply-templates mode="...."> element.
Thanks a lot, you rock!
Anthony Candaele
No worries Anthony. Glad I could help.
is working on a reply...