SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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[);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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