Retrieve Page Title inside XSLT function

Mar 6, 2013 at 5:28 PM
I'm currently working with Community.Blog package customizing the blogRender.xsl function. I'm wanting to retrieve the TITLE of the page that the function is being used in. How do I go about doing this?

FYI, i'm a complete newbie to XSLT, I have done this before using Razor functions (and C#) but I did not want to re-write this function just to accomplish this.

thanks!
Coordinator
Mar 6, 2013 at 10:30 PM
The simplest way would be to emit the following from your xslt:
    <rendering:page.title />
Composite C1 will pick up on this and replace it with the current page title. If the rendering namespace haven't been declared already add xmlns:rendering="http://www.composite.net/ns/rendering/1.0" to the above.

You could also add a call to Composite.Pages.SitemapXml on the Function Calls tab (see markup below for this call) and then use the xpath /in:inputs/in:result[@name='SitemapXml']/Page/@Title to get at the value.
    <f:function name="Composite.Pages.SitemapXml" localname="SitemapXml">
        <f:param name="SitemapScope" value="Current" />
    </f:function>
Mar 18, 2013 at 3:48 PM
The 2nd example worked out well for me, thanks!