Hello. A template name isn't accessible from Xslt directly. However, you can always add some C# (or VB.NET) script to your xslt with a msxml:script element. In your case you could use something like this:
<msxml:script language="C#" implements-prefix="script"> <msxml:assembly name="cms"/> <msxml:assembly name="businesslogic"/> <msxml:using namespace="umbraco.cms.businesslogic.template"/> public string GetTemplateTextById(int id) { return new Template(id).Text; } </msxml:script>
Can I get the Template Name from XSLT?
I want to display the NAME of a template that a node is based on rather than its ALIAS - can I do that in XSLT?
the name() function returns the alias - how can I get the name (name as entered for a template in the Developers section).
If not with XSLT, can I do it via the API / C#?
Hello. A template name isn't accessible from Xslt directly. However, you can always add some C# (or VB.NET) script to your xslt with a msxml:script element. In your case you could use something like this:
and:
<xsl:value-of select="script:GetTemplateTextById($currentPage/@template)"/>
I put the code into an XSLT Extension project ... and it works! Thanks for pointing me in the right direction :-)
FYI, there's also some XSLT extensions built into uComponents for accessing templates - GetTemplateById should work for you - see XSLT Extension - CMS
is working on a reply...