Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
356 views
in SharePoint Server by 8 30 38

Is it possible to get full Current Page URL in ItemStyle.xsl file in SharePoint 2019? I just need to check if the current page URL that holds the Content Query Web Part contains a specific value or not!

I have tried to use $SiteURL and $WebURL but it does not get the current full Page URL?

<xsl:variable name="CurrentPageURL" select="'$SiteURL'" />

How to get Full Current Page URL in XSLT ItemStyle.xsl file in SharePoint 2019? without the need to create a custom function for CQWP?


1 Answer

1 like 0 dislike
by 60 127 273
selected by
 
Best answer

How to Get the full Current Page URL in ItemStyle.xsl file in SharePoint 2019?

In SharePoint ItemStyle.xsl , you can get the current full page URL for a page that hold the Content Query Web Part (CQWP) by defining a new parameter called PageUrl

Steps

  1. Open SharePoint Designer > Open your site collection.
  2. Navigate to All files > Style Library > XSL Style Sheets.
  3. Checkout the ItemStyle.xsl, then Edit it in an advance mode.
  4. At the beginning of ItemStyle.xsl, make sure that you have added the below namespace

     xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
    
  5. Then add this PageUrl parameter.
  6. The final result should look like the following.
    Get full Current Page URL in ItemStyle.xsl file in SharePoint 2019
  7. Finally, you can use the newly created PageUrl parameter in your Item Style as the following:

     <xsl:value-of disable-output-escaping="yes" select="$PageUrl" />
    
If you don’t ask, the answer is always NO!
...