【问题标题】:How to get a particular url value into a xsl variable in Content Query web part - Sharepoint 2010如何将特定 url 值获取到内容查询 web 部件中的 xsl 变量中 - Sharepoint 2010
【发布时间】:2013-05-14 19:44:00
【问题描述】:

我正在使用 Sharepoint 2010 内容查询 Webpart(CQWP) 在页面上显示开箱即用的讨论区列表。我通过更改 ItemStyle.xsl 文件自定义了 CQWP 的外观。我的要求之一是在 CQWP 上获得超链接 - 我有 url 的格式,我需要帮助来使用 xsl 变量构建 url。

网址格式:

https://yourdomain.com/sites/site_name/Lists/Team%20Discussion/NewForm.aspx?RootFolder={$DisplayTitle}&ContentTypeId=0x0107

在上面的 url 格式中,'{$Displaytitle}' 是我通过 xsl:variable 获得的讨论板主题。下面是我用来获取主题的代码sn-p。

<xsl:variable name="DisplayTitle">
           <xsl:call-template name="OuterTemplate.GetTitle">
               <xsl:with-param name="Title" select="@Title"/>
               <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>                   
           </xsl:call-template>
  </xsl:variable>
<xsl:value-of select="$DisplayTitle"/>

现在我正在使用 html 锚标记来获取超链接,例如

<a href="https://yourdomain.com/sites/site_name/Lists/Team%20Discussion/NewForm.aspx?RootFolder={$DisplayTitle}&ContentTypeId=0x0107">Link</a>

但是上面抛出了一个错误,整个 CQWP 没有得到显示。

【问题讨论】:

    标签: xml sharepoint xslt formatting


    【解决方案1】:

    参考。下面的代码解决您的问题。

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    
    <xsl:variable name="DisplayTitle">Para</xsl:variable>
    
    <html>
        <body>
            <a>
                <xsl:attribute name="href">http://www.google.co.in/<xsl:value-of select="$DisplayTitle"/></xsl:attribute>
            </a>
        </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-08
      • 1970-01-01
      • 2016-10-09
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多