Sharepoint XSL/XSLT-添加值作为DIV的样式属性
我正在使用SharePoint 2010和内容查询Web部件从SharePoint列表输出日期列表。此列表的显示由名为ItemStyle.XSL的XSL样式表控制 我在常规外观方面取得了进展,但现在想添加一个它检索到的字段作为背景/样式属性 我相信我遇到的问题与select的xsl值有关,select在标记的末尾有一个结束括号,因此无意中结束了我的DIV。有人能看看下面的代码,并建议在开始DIV中打印CategoryColor的替代方法吗 我还将偶尔在html中插入“xmlns:ddwrt”,我希望至少看到“style:background…” 非常感谢Sharepoint XSL/XSLT-添加值作为DIV的样式属性,sharepoint,xslt,sharepoint-2010,content-query-web-part,Sharepoint,Xslt,Sharepoint 2010,Content Query Web Part,我正在使用SharePoint 2010和内容查询Web部件从SharePoint列表输出日期列表。此列表的显示由名为ItemStyle.XSL的XSL样式表控制 我在常规外观方面取得了进展,但现在想添加一个它检索到的字段作为背景/样式属性 我相信我遇到的问题与select的xsl值有关,select在标记的末尾有一个结束括号,因此无意中结束了我的DIV。有人能看看下面的代码,并建议在开始DIV中打印CategoryColor的替代方法吗 我还将偶尔在html中插入“xmlns:ddwrt”,我
<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>
javascript:SP.UI.ModalDialog.showModalDialog({url:'/services/marketing/Lists/College%20Calendar/DispForm.aspx?ID=',title:'Event Details'});返回false;
变量
类别颜色前面缺少一个$
您有:
<div class="upcoming-events" style="background: {CategoryColour}" ><xsl:value-of select="$CategoryColour"/>
您实际上想要的:
<div class="upcoming-events" style="background: {$CategoryColour}" ><xsl:value-of select="$CategoryColour"/>
我已经试过使用$,但它不起作用。然而,它确实让我更仔细地研究了我的语法,这似乎就是问题所在。当我通过一个十六进制时,我需要一个#和一个很好的方法来关闭属性@mtwelve,我很高兴讨论语法让你走上了正确的道路。