【发布时间】:2010-02-19 14:16:06
【问题描述】:
现在,当我为 Sitecore 中由 xslt 渲染渲染的项目设置发布限制时,xslt 只会输出在网站上看起来不太好看的空块。
这是我用来渲染我的 Sitecore 项目的 xslt 代码:
<xsl:for-each select="$item[sc:fld('__created',.)]">
<xsl:for-each select="sc:Split('Agenda-items',$item)">
<xsl:variable name="thisitem" select="sc:Split('Agenda-items',$item)" />
<xsl:variable name="loopitem" select="sc:item(text(),.)" />
<xsl:if test="$item[sc:fld('__created',.)]">
<div class="agendaItem">
<div class="agendaDatum">
<span class="agendaDag">
<sc:date field="Begindatum" format="dd" select="$loopitem" />
</span>
<span class="agendaMaand">
<sc:date field="Begindatum" format="MMM" select="$loopitem" />
</span>
</div>
<div class="agendaTekst">
<sc:link select="$loopitem" title="" class="rood">
<sc:text field="Titel" select="$loopitem" />
</sc:link>
<br />
<span class="agendaUitleg">
<xsl:value-of select="stringutil:Clip(sc:field('Intro',$loopitem), 60, 1)"/> 
</span>
</div>
</div>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
我想要检查一个项目是否有可用的上下文语言版本,该版本不受当前日期显示的限制。比如:
现在是 2010 年 2 月 12 日,我有一个项目在 2010 年 2 月 11 日至 2010 年 2 月 16 日期间被限制发布。现在它不会显示,这正是我想要的。但不是不显示我的跨度和 div,它只会用空信息填充它们。这会导致网站上出现空块,这有点难看:
Empty :/ http://www.bibliotheekmb.nl/images/emptycellblocks.png
因此,此块的顶部一项显示了一项,但它被限制发布。我如何在 xslt 中处理这个?
Sitecore 演示文稿 xslt 食谱说:
<xsl:for-each select="$sc_currentitem/item[sc:fld('__created',.)]">
<!--the context element is an item with a version in the context language-->
</xsl:for-each>
这是选择具有上下文语言版本的项目,但不适用于我想要的。
【问题讨论】: