0

I have the following markup:

<ul id="slider">    
    <!-- slider item -->
    <li>
        ...
    </li>
    <!-- end of slider item -->
</ul>

and I have defined the following xsl in header.xsl and itemStyle.xsl for displaying data from a SharePoint 2010 List:

<!-- in header.xsl -->
<xsl:template name="Slider" match="*[@GroupStyle='Slider']" mode="header">
    <ul id="slider">
    </ul>
</xsl:template>

<!-- in itemStyle.xsl -->
<xsl:template name="Slider" match="Row[@Style='Slider']" mode="itemstyle">
    <xsl:variable name="SafeImageUrl">
        <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
            <xsl:with-param name="UrlColumnName" select="@Picture"/>
        </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="Title">
        <xsl:call-template name="OuterTemplate.GetTitle">
            <xsl:with-param name="Title" select="@Title" />
        </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="Details">
        <xsl:call-template name="OuterTemplate.GetTitle">
            <xsl:with-param name="Title" select="@Details" />
        </xsl:call-template>
    </xsl:variable>
    <li>
        <img src="{$SafeImageUrl}" alt="{$Title}" />
        <section class="media-description">
            <h2 class="slider-headline"><xsl:value-of  disable-output-escaping="yes" select="$Title" /></h2>
            <p><xsl:value-of disable-output-escaping="yes" select="$Details" /></p>
        </section>
    </li>
</xsl:template>

but the thing is, I want the ul element to wrap those li's directly, as shown above in the markup, so how can I do that ? or is there a better way to achieve that ?

1

Put the ULs inside contentquerymain.xsl instead of header.xsl

  • can u explain a bit please, how should I put them ? and how will they be applied ? – Anas Nakawa Jul 17 '11 at 8:43
  • 1
    You'll need to copy & paste Contenquerymain.xsl as a new file, and have your CQ web part point to the new xsl file. The ContentQueryMain.xsl file will have a moment where it calls the ItemStyle templates. Essentially, you want to wrap your UL tags around the call to the ItemStyle. Here's a blog post that explais customising the cqmain.xsl file - panvega.wordpress.com/2009/03/20/… – James Love Jul 17 '11 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.