I would like to customise the Content Query Webpart like i normally do with DWP but i know its a different approach.

All i want to do is to get the title name and turn it into a link and when you click the title link i want it come up with a a custom page that i would create and pass some querystring parameters to it.

Something like this


<a href="#" onclick="openDialog('/sites/Sample/Pages/GMComms.aspx?ID={@ID}','{$title}'); return true "><xsl:value-of select="@Title"/></a>

the openDialog is the


Any ideas would be appreciated.


In that case you'll have to either modify or create a new XSLT Template in the ItemStyle.xsl file, which you find in the /Style Library/XSLT Style Sheets/ItemStyle.xsl

In the template you can insert javascript as follow:

<script language="javascript" defer="true">
      $(document).ready( function() {
        // logic here

        // Example to include XSLT variables
        $('#AnchorID').click(function () {
          var url = $(this).attr('href');
          SP.UI.ModalDialog.openModalDialog(url,]]> <xsl:value-of select="$title"/> <![CDATA[);

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.