What inbuilt parameters can I access in Sitecore XSLT? How should I expose global settings I need?

情到浓时终转凉″ 提交于 2019-12-02 06:39:25
Paul Tiemann

Reflector shows that the following are automatically added:

list.AddParam("id", string.Empty, item.ID.ToString());
list.AddParam("lang", string.Empty, Language.Current.Name);
list.AddParam("sc_lang", string.Empty, Language.Current.Name);
list.AddParam("sc_item", string.Empty, GetNodeIterator(item));
James Walford

The full list of available Sitecore extensions for xsl helper functions is documented in the API reference helpfile, available from the link.

The XSL helper functions are contained in the XslHelper Class

Namespaces ► Sitecore.Xml.Xsl ► XslHelper

The helpfile documentation is for C# (in which the extensions are built), but as the documentation notes:

Helper functions for use with xsl files. The public functions in this class can be called from an xsl file by using the sc prefix (ex. sc:fld(...))

Stating personal opinion, I think you should be grabbing the answer you already see right in front of you - forget about XSLT and just do C#. I don't know of many (in fact, any) seasoned Sitecore developers who stick with XSLT for anything but the most basic of renderings. This too, is of course, just my own personal view - but I've seen similar statements from many of the Sitecore bloggers out there.

And to answer your question, the drawback is complexity and development time. In writing your functionality, then writing and maintaining XSL helper libraries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!