XSL Properties

XSL Properties

XSLT Renderings

  • A small sub-section/building block of a page written as XSL
  • Uses XSL to transform Sitecore’s native XML into presentation code (XHTML )
  • Can be statically or dynamically placed on a layout or sublayout
  • Always have a “context item”
  • Sitecore automatically provides initial rendering code
  • Most of the template is boilerplate that you can ignore in this class
  • You provide HTML output plus XSLT code in the main section
  • Create in Developer Center instead of VS2008 so the rendering definition item is created in the Sitecore Content Tree

XSL Properties C# Web Control Code

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

Sitecore.Web.UI.WebControls.XslFile xslFile = new Sitecore.Web.UI.WebControls.XslFile();
xslFile.Path = "/xsl/TIC/Logo.xslt";

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

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

//using : for colon and ? for question mark and   for space
output.Write("{0}&#58;&#160;{1}", "Name", "<b>" + xslFile.RenderingName + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Cache Timeout", "<b>" + xslFile.CacheTimeout.ToString() + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Data Source", "<b>" + xslFile.DataSource + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "Is Enabled", "<b>" + xslFile.Enabled.ToString() + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "Has Border", "<b>" + xslFile.Bordered.ToString() + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Height", "<b>" + xslFile.Height.ToString() + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "Is Cacheable", "<b>" + xslFile.Cacheable + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Rendering Name", "<b>" + xslFile.RenderingName + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "Themes Enabled", "<b>" + xslFile.EnableTheming.ToString() + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "ViewState Enabled", "<b>" + xslFile.EnableViewState.ToString() + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Width", "<b>" + xslFile.Width.ToString() + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "XSLT File Path", "<b>" + xslFile.Path + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "XSLT Script Enabled", "<b>" + xslFile.EnableScript.ToString() + "</b>");
output.RenderEndTag(); //Div

XSL Properties C# Web Control Output

Cache Timeout: 00:00:00
Data Source: 
Is Enabled? True
Has Border? False
Is Cacheable? False
Rendering Name: 
Themes Enabled? True
ViewState Enabled? True
XSLT File Path: /xsl/TIC/Logo.xslt
XSLT Script Enabled? False