Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore presentation: Not using XSLT renderings at all

I am new to Sitecore and our team is building our first project using Sitecore. As I look through a lot of the tutorials, most of them use XSLT renderings. But I was wondering whether everything that can be done with XSLT can also be done through a Sublayout (e.g. rendering a collection of content)? If possible, I would like to avoid XSLTs for this project.

Thanks!

like image 300
feiyingx Avatar asked Feb 23 '23 09:02

feiyingx


2 Answers

There are three main types of rendering technologies used with Sitecore. Together they fall under the "rendering" umbrella term. XSLT is quite unpopular as it is it's own language. WebControls and Sublayouts are similar but different approaches to almost the same thing. Both are implemented in C#.

  1. XSLT - XSL transformation files using the XSLT language. Limited functionality can be implemeneted with these
  2. WebControls - these are C# classes that get compiled into a DLL and used as server controls. Lots of functionality can be done here but the caveat is that front-end code is written in C# using HtmlTextWriters (IMO: "blah!")
  3. Sublayouts - These are User Controls that have both a front-end ascx file and ascx.cs CodeBehind to separate the front-end end from the back-end logic. This is just like a WebControl but separates the design and logic concerns to make it easy to write re-usable components. Any functionality can be created in these and its possible to build entire sites with just sublayouts (in addition to layouts).

For Sitecore's official documentation on these technologies, they're explained in the Presentation Component Reference on the SDN under the section Choosing Presentation Technology.

My opinion: sublayouts are the way to go.

like image 129
Mark Ursino Avatar answered Mar 07 '23 01:03

Mark Ursino


Everything that can be done in XSLT can be done in a SubLayout (which is just an ASCX or WebControl). There are in fact some things that are difficult to do in XSLT, and in fact are done better in a SubLayout.

The main reason to do XSLT is mostly for easy output. It's alot easier to output some HTML and display fields, but it is by no means required.

I've been using Sitecore for a year now, and I haven't found any problems where I had to use XSLT.

like image 43
Jason Avatar answered Mar 07 '23 02:03

Jason