and ...">

Sitecore: How to Get "Display Name" in XSLT

I tried <sc:text field="Display Name" />
and
<xsl:value-of select="sc:fld('Display Name',.)"/>
and
<xsl:value-of select="sc:field('Display Name',.)"/>
a variety of different events and intervals.

All I can find on the Internet are examples of how to get it in .NET code Sitecore.Context.Item.DisplayName

Am I missing something obvious? It bothered me a little.

+3
source share
2 answers

Most of the standard fields in the Sitecore element are prefixed with double underscores. I believe that you will find your value in the "__display name".

+6
source

You can use the display name of the method from XSLHelper (namespace: Sitecore.Xml.Xsl)
this will be used in xslt, like this

<xsl:value-of select="sc:displayname($sc_currentitem)" />

: , ,
, .

public string DisplayName
{
        get
    {
        if (!UserOptions.View.UseDisplayName)
        {
            return this.Name;
        }
        string text = base[FieldIDs.DisplayName];
        if (text.Length > 0)
        {
            return text;
        }
        return this.Name;
    }
}
+3

Source: https://habr.com/ru/post/1775119/


All Articles