XSLT Tip: Get Current Page URL

by Steve Sofian 21. July 2009 12:18

Quite often we will be writing custom XSL to customize the display of a Content Query Web Part (CQWP) and at times we would want to get the current page URL where the CQWP web part lives.  For example, providing a link to a custom page to display your item as shown below, where the “Details” link is pointing to a custom page.

image

However, you would like to be able to get back to the origin page where the link is clicked.  You could achieve this by doing the following in your custom XSL:

Step 1:  Add the following namespace to your custom XSL:

xmlns:ddwrt=”http://schemas.microsoft.com/WebParts/v2/DataView/runtime

image

Step 2:  Add a parameter name “PageUrl” right after XSL Stylesheet declaration:

<xsl:param name=”PageUrl” />

image

Step 3:  Add a query string to the link:

image

Step 4:  Add a link or button on your custom page and the following OnClick event:

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Tips

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 Steve Sofian
Locations of visitors to this page