Page URL

Topics: XSLT
Jun 10, 2011 at 4:43 PM

This seems pretty simple, but I can't seem to find the way to do this...

in XSLT how can I get the current page's URL?  I am assuming I need a function call to SitemapXml, but then I'm not sure how to figure out to extract the current page, and then get the URL from it.  Thanks.

Jun 10, 2011 at 5:00 PM
Edited Jun 10, 2011 at 5:01 PM

<f:functions xmlns:f="http://www.composite.net/ns/function/1.0">
  <f:function name="Composite.Pages.SitemapXml" localname="SitemapXml">
    <f:param name="SitemapScope" value="Current" />
  </f:function>
</f:functions>

Sep 9, 2011 at 2:16 AM

Has anyone figured out how to do this...?

Sep 9, 2011 at 7:31 AM

To get current page URL in XSLT you can:

1) Function calls tab -> add function Composite.Pages.SitemapXml call -> set parameter SitemapScope to Current -> on the Template tab:

 <a href="{/in:inputs/in:result[@name='SitemapXml']/Page/@URL}">Current Page</a>
or

2) Function calls tab -> add function Composite.Pages.GetPageId  call -> set parameter Page association to Current page -> on the Template tab:

for 2.1.1 version:

 <xsl:variable name="pageId" select="/in:inputs/in:result[@name='GetPageId']" />
 <a href="/Renderers/Page.aspx?pageId={$pageId}">Current Page</a>

for 2.1.3+ version:

 <xsl:variable name="pageId" select="/in:inputs/in:result[@name='GetPageId']" />
 <a href="~/page({$pageId})">Current Page</a>