> how do I capture the URL of the displaying C1 page to use in the function?
In XSLT, one way would be to make a function call to Composite.Pages.GetPageId, which returns the current page's ID by default.
In your XSLT, add a variable that uses the return value:
<xsl:variable name="currentPage" select="/in:inputs/in:result[@name='GetPageId']" />
and use the value of this variable to form the URL:
~/page({$currentPage})
The latter will be resolved to a normal URL by Composite C1
/Vitaly