2

I have created custom CQWP web part in which i am sliding news contents. I have created structure for sliding contents. Now i want to add JQuery file reference in my CQWP web part but it gives error while adding reference in Mainfile of CQWP.

I have tried this code but it gives error..

<xsl:template match="/">
        <xsl:value-of disable-output-escaping="yes" select="string('<script src=&quot;/SiteAssets/jquery-1.9.1.min.js&quot;></script>')"/>
        <xsl:value-of disable-output-escaping="yes" select="string('<script src=&quot;/SiteAssets/jssor.js&quot;></script>')"/>
        <xsl:call-template name="OuterTemplate"/>
</xsl:template>

Please help to how to add external script reference in CQWP web part?

4

Following snippet can be used to reference the jQuery in your XSLT webpart.

Inline Script Block:

<xsl:text disable-output-escaping="yes"> 
    <![CDATA[ 
        <script type="text/javascript"> 
            (your JavaScript code here) 
        </script> 
    ]]> 
</xsl:text>

Script Reference Block:

<xsl:text disable-output-escaping="yes"> 
    <![CDATA[ 
        <script type="text/javascript" src="/SiteAssets/jquery-1.9.1.min.js"></script> 
    ]]> 
</xsl:text>
  • 1
    Thanks @Predip.. It works like a charm...!! Thank you so much..!! – Kaushal Khamar Jul 10 '15 at 12:00

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.