开发者

Content Query Web Part. How do I get the "ItemStyle" name in the xlst?

开发者 https://www.devze.com 2023-02-28 06:31 出处:网络
I have adapted my Content Query Web Part (CQWP) so it generates \"ul\" tags instead of \"table\" tags. It uses a custom \"ContentQueryMain.xls\" and a custom \"ItemStyle.xsl\".

I have adapted my Content Query Web Part (CQWP) so it generates "ul" tags instead of "table" tags. It uses a custom "ContentQueryMain.xls" and a custom "ItemStyle.xsl".

I would like to add my ItemStyle as a cssclass to the opening tag of my "ul" tag. So the html looks like this.

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

The opening tag is generated by the (custom) "ContentQueryMain.xls". Does anybody know how I can access the Item开发者_开发问答Style value in the "ContentQueryMain.xls"?

Thanks, W0ut


I just found the answer myself.

In the "ContentQueryMain.xls" you can select the itemStyle by using this xslt

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


Note: to avoid exceptions you probably want to include a test to see if the $Rows variable contains any results / data.

Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消