SharePoint 2010とコンテンツクエリWebパーツを使用して、SharePointリストから日付のリストを出力しています。このリストの表示は、ItemStyle.xslと呼ばれるXSLスタイルシートによって制御されます。
一般的な外観は進歩しましたが、取得するフィールドの1つを背景/スタイル属性として追加したいと思います。
私が抱えている問題は、xsl値に関連していると思います。つまり、タグの最後に閉じ括弧があり、誤ってDIVを閉じてしまうというselectです。誰かが以下のコードを見て、オープニングDIV内でCategoryColourを印刷する別の方法を提案できますか?
また、少なくとも「style:background...」が表示されると予想される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>