我正在使用SharePoint 2010和内容查询Web部件从SharePoint列表中输出日期列表。该列表的显示由名为ItemStyle.xsl的XSL样式表控制。
我已经在一般外观方面取得了进展,但现在想将其检索到的一个字段作为背景/样式属性添加。
我认为我遇到的问题与xsl value-of select在标签末尾有一个闭合括号有关,因此无意中关闭了我的DIV。有人可以查看下面的代码并建议以替代方式打印CategoryColour在开放DIV内。
我还会偶尔在HTML中插入“xmlns:ddwrt”,而我至少希望看到“style:background....”。
非常感谢。
我已经在一般外观方面取得了进展,但现在想将其检索到的一个字段作为背景/样式属性添加。
我认为我遇到的问题与xsl value-of select在标签末尾有一个闭合括号有关,因此无意中关闭了我的DIV。有人可以查看下面的代码并建议以替代方式打印CategoryColour在开放DIV内。
我还会偶尔在HTML中插入“xmlns:ddwrt”,而我至少希望看到“style:background....”。
非常感谢。
<xsl:stylesheet
version="1.0"
exclude-result-prefixes="x d xsl msxsl cmswrt"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!-- PrettyCal Template -->
<xsl:template name="PrettyCal" match="Row[@Style='PrettyCal']" mode="itemstyle">
<xsl:variable name="Start"><xsl:value-of select="@EventDate" /></xsl:variable>
<xsl:variable name="End"><xsl:value-of select="@EndDate" /></xsl:variable>
<xsl:variable name="AllDay"><xsl:value-of select="@AllDayEvent" /></xsl:variable>
<xsl:variable name="Location"><xsl:value-of select="@EventLocation" /></xsl:variable>
<xsl:variable name="CategoryColour"><xsl:value-of select="@EventCategoryColour" /></xsl:variable>
<div class="upcoming-events" style="background: {CategoryColour}" ><xsl:value-of select="$CategoryColour"/>
<h2 class="event-title">
<a>
<xsl:attribute name="onClick">
javascript:SP.UI.ModalDialog.showModalDialog({ url: '/services/marketing/Lists/College%20Calendar/DispForm.aspx?ID=<xsl:value-of select="@ID" />', title: 'Event Details' }); return false;
</xsl:attribute>
<xsl:value-of select="@Title" /></a></h2>
</div>
</xsl:template>
</xsl:stylesheet>