Xslt Sharepoint 2010 xsl@PublishingPageImage在列表Web部件中显示空白文本

Xslt Sharepoint 2010 xsl@PublishingPageImage在列表Web部件中显示空白文本,xslt,sharepoint,sharepoint-2010,Xslt,Sharepoint,Sharepoint 2010,我正在为一个站点实现一个自定义的新闻摘录列表视图。它有4个字段 头衔 短文 全文的URL 形象 目前,我已成功地使用列表编辑表单中的4个基本文本字段使其看起来正确,但是,Sharepoint中有一项功能,允许用户使用内置浏览器从服务器中选择已发布的图像。该图像随后以html格式存储在“PublishingPageImage”字段中。然而,我意识到,由于某种原因,任何包含html的字段都会返回为空白,当我将基本URL文本字段切换为已发布的图像类型时,就会出现这种情况。此外,链接html不再使用

我正在为一个站点实现一个自定义的新闻摘录列表视图。它有4个字段

  • 头衔
  • 短文
  • 全文的URL
  • 形象
目前,我已成功地使用列表编辑表单中的4个基本文本字段使其看起来正确,但是,Sharepoint中有一项功能,允许用户使用内置浏览器从服务器中选择已发布的图像。该图像随后以html格式存储在“PublishingPageImage”字段中。然而,我意识到,由于某种原因,任何包含html的字段都会返回为空白,当我将基本URL文本字段切换为已发布的图像类型时,就会出现这种情况。此外,链接html不再使用Sharepoint的超链接字段类型显示

我尝试过在web上使用许多建议的方法,但是,它们都在web部件上为我抛出错误

    Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.


    Correlation ID:ae8f04be-849f-454f-843a-d2f7487b31d8
如果您对我的代码有任何建议,我将不胜感激,因为我对xsl的世界还相当陌生。Sharepoint Designer似乎显示xsl没有问题

<!--
This section is the set up and can be used at the top of any external XSLT stylesheet file
-->
<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">
<xsl:output method="html" indent="no"/>
<!--
End of Set Up
-->
<!--
The initial template which in this case is matching everything with "/"
It then creates a variable called Rows - this is accessed as $Rows
A standard HTML table and header row with the names of our columns is next followed by a loop through each row of the list and calls our second template dvt1-rowview to display the contents
-->
<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
<link rel="stylesheet" type="text/css" href="/Transportation/Styles/styles.css" />
<ul class="section-list">
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview" />
</xsl:for-each>
</ul>
</xsl:template>
<!--
End of first template
-->
<!--
Standard HTML rows and cells contain the contents of our list row
xsl:value-of command is used to display our columns
Columns are accessed as @InternalColumnName
-->
<xsl:template name="dvt_1.rowview">
<li>

<xsl:if test="@PublishingPageImage != ''">
        <xsl:value-of select="@PublishingPageImage" disable-output-escaping="yes"/>
</xsl:if>

<h3><xsl:value-of select="@Title" /></h3>
<p><xsl:value-of select="@Short_Content"/></p>


<p><xsl:value-of select="@Link" disable-output-escaping="yes"/></p>
</li>
</xsl:template>
</xsl:stylesheet>

  • 显示图像

    取imgsrc中image的列值,如下例所示

    <xsl:variable name="url" >
         <xsl:value-of select="@PublishingPageImage" disable-output-escaping="yes"/>
      </xsl:variable>
    <xsl:variable name="imglink" select="substring-before($url,',')" > </xsl:variable>
    <div class="image"><img src="{$imglink}" width="296px;" height="200px;"></img></div>
    
    
    
    显示图像

    取imgsrc中image的列值,如下例所示

    <xsl:variable name="url" >
         <xsl:value-of select="@PublishingPageImage" disable-output-escaping="yes"/>
      </xsl:variable>
    <xsl:variable name="imglink" select="substring-before($url,',')" > </xsl:variable>
    <div class="image"><img src="{$imglink}" width="296px;" height="200px;"></img></div>
    
    
    
    显示图像

    取imgsrc中image的列值,如下例所示

    <xsl:variable name="url" >
         <xsl:value-of select="@PublishingPageImage" disable-output-escaping="yes"/>
      </xsl:variable>
    <xsl:variable name="imglink" select="substring-before($url,',')" > </xsl:variable>
    <div class="image"><img src="{$imglink}" width="296px;" height="200px;"></img></div>
    
    
    
    显示图像

    取imgsrc中image的列值,如下例所示

    <xsl:variable name="url" >
         <xsl:value-of select="@PublishingPageImage" disable-output-escaping="yes"/>
      </xsl:variable>
    <xsl:variable name="imglink" select="substring-before($url,',')" > </xsl:variable>
    <div class="image"><img src="{$imglink}" width="296px;" height="200px;"></img></div>
    

    因此,问题不在于xslt,而在于sharepoint的一个怪癖。我会回答这个问题,以防有人碰到同样的问题

    如前所述,我使用的是列表Web部件,XSLT用于列表视图,或XLV。要将图像添加到我想要的列表视图中,首先,我将页面图像(也可以是另一个发布图像字段)添加到列表本身。然后我把它添加到我在网页上显示的列表视图中。然后,在列表的web部件设置中,我必须再次将web部件指向更新的列表视图。Sharepoint本身可能会在此时生成自己的xsl缓存,这就是为什么在修改列表视图时我必须再次将其指向列表视图的原因

    我发现有一个很好的小片段帮助解决了这个问题:

    <xsl:for-each select="@*">
        <xsl:value-of select="name()"/>
        <xsl:text> = </xsl:text>
        <xsl:value-of select="."/><br/>
    </xsl:for-each> 
    
    
    = 
    
    资料来源:


    嵌套在行模板中时,它为您提供每行的每个字段名和值。如果您希望检查并查看字段是否显示,或者查找字段的特定名称,或者

    ,那么这很好。因此,问题不在于xslt,而只是sharepoint的一个怪癖。我会回答这个问题,以防有人碰到同样的问题

    如前所述,我使用的是列表Web部件,XSLT用于列表视图,或XLV。要将图像添加到我想要的列表视图中,首先,我将页面图像(也可以是另一个发布图像字段)添加到列表本身。然后我把它添加到我在网页上显示的列表视图中。然后,在列表的web部件设置中,我必须再次将web部件指向更新的列表视图。Sharepoint本身可能会在此时生成自己的xsl缓存,这就是为什么在修改列表视图时我必须再次将其指向列表视图的原因

    我发现有一个很好的小片段帮助解决了这个问题:

    <xsl:for-each select="@*">
        <xsl:value-of select="name()"/>
        <xsl:text> = </xsl:text>
        <xsl:value-of select="."/><br/>
    </xsl:for-each> 
    
    
    = 
    
    资料来源:


    嵌套在行模板中时,它为您提供每行的每个字段名和值。如果您希望检查并查看字段是否显示,或者查找字段的特定名称,或者

    ,那么这很好。因此,问题不在于xslt,而只是sharepoint的一个怪癖。我会回答这个问题,以防有人碰到同样的问题

    如前所述,我使用的是列表Web部件,XSLT用于列表视图,或XLV。要将图像添加到我想要的列表视图中,首先,我将页面图像(也可以是另一个发布图像字段)添加到列表本身。然后我把它添加到我在网页上显示的列表视图中。然后,在列表的web部件设置中,我必须再次将web部件指向更新的列表视图。Sharepoint本身可能会在此时生成自己的xsl缓存,这就是为什么在修改列表视图时我必须再次将其指向列表视图的原因

    我发现有一个很好的小片段帮助解决了这个问题:

    <xsl:for-each select="@*">
        <xsl:value-of select="name()"/>
        <xsl:text> = </xsl:text>
        <xsl:value-of select="."/><br/>
    </xsl:for-each> 
    
    
    = 
    
    资料来源:


    嵌套在行模板中时,它为您提供每行的每个字段名和值。如果您希望检查并查看字段是否显示,或者查找字段的特定名称,或者

    ,那么这很好。因此,问题不在于xslt,而只是sharepoint的一个怪癖。我会回答这个问题,以防有人碰到同样的问题

    如前所述,我使用的是列表Web部件,XSLT用于列表视图,或XLV。要将图像添加到我想要的列表视图中,首先,我将页面图像(也可以是另一个发布图像字段)添加到列表本身。然后我把它添加到我在网页上显示的列表视图中。然后,在列表的web部件设置中,我必须再次将web部件指向更新的列表视图。Sharepoint本身可能会在此时生成自己的xsl缓存,这就是为什么在修改列表视图时我必须再次将其指向列表视图的原因

    我发现有一个很好的小片段帮助解决了这个问题:

    <xsl:for-each select="@*">
        <xsl:value-of select="name()"/>
        <xsl:text> = </xsl:text>
        <xsl:value-of select="."/><br/>
    </xsl:for-each> 
    
    
    = 
    
    资料来源:


    嵌套在行模板中时,它为您提供每行的每个字段名和值。如果您想查看字段是否显示,或者查找字段的特定名称,或者

    它仍然没有加载任何图像,这是很好的,我复制了它