XSL Settings

XSL Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings
  • Sitecore.Configuration.Settings.Profiling
  • Sitecore.Configuration.Settings.Trace
  • Sitecore.Context
  • Sitecore.Data.Items.Item

XSL Settings C# Web Control Code

Sitecore.Data.Items.Item item = Sitecore.Context.Item;
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

string enableXslDocumentFunction = Sitecore.Configuration.Settings.EnableXslDocumentFunction.ToString();
string enableXslScripts = Sitecore.Configuration.Settings.EnableXslScripts.ToString();
string formattingXslFile = Sitecore.Configuration.Settings.Profiling.FormattingXslFile;
string traceFormattingXslFile = Sitecore.Configuration.Settings.Trace.FormattingXslFile;

output.Write("{0}&#58;&#160;{1}", "Enable Xsl Document Function", "<b>" + enableXslDocumentFunction + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Enable Xsl Scripts", "<b>" + enableXslScripts + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Profiling Formatting Xsl File", "<b>" + formattingXslFile + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Trace Formatting Xsl File", "<b>" + traceFormattingXslFile + "</b>");

output.RenderEndTag(); //Div


XSL Settings C# Web Control Output

Enable Xsl Document Function: True
Enable Xsl Scripts: False
Profiling Formatting Xsl File: /sitecore/debug/profile.xslt
Trace Formatting Xsl File: /sitecore/debug/trace.xslt