【问题标题】:Content Query Web Part. How do I get the "ItemStyle" name in the xlst?内容查询 Web 部件。如何在 xslt 中获取“项目样式”名称?
【发布时间】:2011-04-22 21:44:56
【问题描述】:

我已经调整了我的内容查询 Web 部件 (CQWP),以便它生成“ul”标签而不是“table”标签。它使用自定义的“ContentQueryMain.xls”和自定义的“ItemStyle.xsl”。

我想将我的 ItemStyle 作为 cssclass 添加到我的“ul”标签的开始标签中。所以html看起来像这样。

>     >  <ul class="CustomItemStyle">
>     >     <li> --HTML content goes here-- </li>
>     >     <li> --HTML content goes here-- </li>   </ul>

开始标签由(自定义)“ContentQueryMain.xls”生成。有人知道我如何访问“ContentQueryMain.xls”中的 ItemStyle 值吗?

谢谢, W0ut

【问题讨论】:

    标签: sharepoint sharepoint-2010


    【解决方案1】:

    我自己找到了答案。

    在“ContentQueryMain.xls”中,您可以使用此 xslt 选择 itemStyle

        <xsl:variable name="FooBar" select="$Rows[1]/@Style" />  
        The selected ItemStyle: <xsl:value-of select="$FooBar" />
    


    注意:为避免出现异常,您可能希望包含一个测试以查看 $Rows 变量是否包含任何结果/数据。

    希望对您有所帮助。

    【讨论】:

    • +1 完美解决方案。但是 - 如果没有行怎么办 - 但你仍然想看看他们会是什么风格?即,假设您对不同的 cqwp 使用相同的 xslt 文件,则判断哪个 Web 部件正在“调用”xslt。
    猜你喜欢
    • 2020-03-17
    • 2011-10-19
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多