【发布时间】:2011-05-21 06:03:39
【问题描述】:
我是 XSLT 的新手,我也是 Sharepoint 的新手。
我已修改我的 XLV Web 部件,使其具有以下 xml:
<xsl>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:template match="View[@BaseViewID='0']" mode="full" ddwrt:ghost="always">
<div class="box whatsnew">
<div class="boxcontent">
<h2><xsl:value-of select="List/@title" /></h2>
<p><xsl:value-of select="List/@description" /></p>
<ul>
<xsl:for-each select="$AllRows">
<li>
<em><xsl:value-of select="@Date" /></em><br />
<a href="{@Link}"><xsl:value-of select="@Text" /></a>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:template>
</xsl:stylesheet>
</xsl>
当我在 SharePoint 设计器中以设计模式查看我的 WebPart 时,列表项会按照我的预期填充。
但是当我将更改发布到 SharePoint 网站时,其中三个值返回为空白。这些值是 for-each 语句中的值:@Date、@Text 和 @Link。
我一直在寻找答案。无济于事。关于为什么此代码在我的实时 Sharepoint 网站上不起作用的任何想法?任何见解将不胜感激!
【问题讨论】:
-
你能给我们一个输入 XML 和输出的样本吗?这样我们就不必询问您是否获得了
<h2>元素,以及每个输入行的<li>等等。
标签: xml sharepoint web-parts xslt