Wednesday, January 5, 2011

XSLT in Umbraco

We have already described the content delivery model in Umbraco in my earlier post. So now let’s see how XSLT is used to created html out of the generated Umbraco XML content. In Umbraco the XML is generated based on the Document type alias and properties type alias.



This is a Sample XML generated (based on the Runway package). Here you can see the XML nodes created based on the RunwayHomepage and RunwayTextpage Document types. Also you can see the corresponding properties alias like bodyText, siteName , siteDescription etc.

I have already defined XSLT in my earlier post. It’s very easy to create an XSLT in Umbraco. Just follow the steps given

• Go to developer section
• Right click XSLT
• Create – file name and choose a template
• You are done

Following are the benefits of XSLT out of the box in Umbraco
• Insanely fast compiled code
• Easy to edit
• Caching is free
• Flexible and reusable
• Generates nice (x)html
• Easy to extend and ships with helpful libraries
An empty XSLT file created out of the box in Umbraco looks like as follows



You can write the code logic inside the marked section in the above code. You can use for each , if else , Umbraco libraries etc inside the XSLT to implement a functionality.
Please feel free to watch a good video demonstration in the following url http://umbraco.org/help-and-support/video-tutorials/umbraco-fundamentals/xslt-in-umbraco-45/xslt-and-umbraco

Tuesday, January 4, 2011

XSLT - Transformation example

In my previous I have briefed about XSLT. Now let’s walk through how XSLT transformation is being done.
Let’s consider the following XML document. Here I have created a Company.XML as follows



Now we need to create an XSL style sheet as follows Company.xsl



Now we need to link the XSL style sheet with the XML document as follows.



If we have an XSL compliant browser, we can nicely transform XML document into XHTML. So here we have the output as follows

XSLT

XSL stands for EXtensible Stylesheet Language which is a style sheet language for XML documents. XSLT stands for XSL transformations. When we talk about XSLT, we come across the key words XML and XPath. Basically XSLT is a language for transforming XML documents into XHTML documents or other XML documents. XSLT uses XPath to find information in XML documents.

XSLT transforms a source XML document into another type of document type recognized by browsers like HTML or XHTML. With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more.

XSLT uses XPath to navigate through the documents to find the information. During transformation process, XSLT uses XPath to define parts of source document to match one or more predefined templates. Once a match is found it transforms the selected section onto a result document. All major browsers supports XML and XSLT.

Monday, January 3, 2011

Templates in Umbraco

In my earlier post I have briefed on Umbraco document types. Now it’s the time to write down about Templates in Umbraco. Umbraco template is basically a text/(X)Html combined with Umbraco tags.

Umbraco templates has the following functionalities such as
• Inserting property from the current page
• Inserting macros/dynamic content
• Manage the central layout of the site

Templates can be created from the Settings section in Umbraco administration. Also corresponding templates are created when a new Document type is created. We can associate a template with a Document type.

Document Type in Umbraco

Document type is a key element of Umbraco. It defines the properties, templates and hierarchy to be used for the content elements. The architecture of Umbraco does not allow creating a content element without a document type.

Document types define the fields to enter data. These fields are called properties in Umbraco. Properties have metadata. The items in the metadata include Name, Alias, Type and Tab. Name refers to a user friendly name of the property. Alias refers to the text used by Umbraco in GET_ITEM calls. Type refers to Data type in Umbraco. Tabs are used to organize document properties. Tabs hold only a single metadata called Name which is used to identify the tab.

Structure tab is the place where we can control the hierarchy of the site. Info tab is the first tab on a document type. This represents the display options for the document type. Info tab has got the following metadata items such as Name, Alias, Icon, Thumbnail, Description, Allowed templates and Default template. Name refers to a user friendly name of the document type. Alias is a text used by Umbraco. Icon is the image displayed in the content tree. Thumbnail refers to a large image that shows on the Create Page dialog. Description holds the information about the document type. An allowed template allows managing the templates associated with this document type.

Next I will jot down a brief introduction to templates in Umbraco.

Sunday, January 2, 2011

Umbraco – XML Schema

Let’s jot down the importance of XML schema in Umbraco. As I have posted earlier Umbraco is a most flexible open source CMS based on .NET technology. Let’s discuss on an overview of how Umbraco works with the content.




Here the whole content gets stored in Database. Every time a new document is created or edited, the data gets stored in database in normal tables. Here comes the publishing logic which is entirely different from the create/edit logic. Publishing process fetches the content from the database and generates the XML out of it.
Here the publishing logic performs two actions such as
• Stores the data as XML in database itself for easy access
• Stores the data in a physical file called umbraco.config under App_Data folder in Umbraco root and finally places the data onto XML cache which helps to increase the performance.
Every time a request comes to the website, instead of going to the database, fetches the data directly from the XML cache. This increases the overall performance of the website. Umbraco relies on its document types and its properties to generate the corresponding XML.
Keep watching for Document types in my next blog.

Umbraco – an Open Source CMS

Recently I had a number of chances to work with the most popular Umbraco CMS, so I planned to pen down an introduction to the most flexible CMS. Umbraco is a leading .NET based open source content management system platform for publishing content on the web.
Basically it’s written in C# and deployed on Microsoft infrastructure, stores the data in a number of relational databases like SQL Server. Umbraco is typically deployed in IIS. Umbraco is built upon Microsoft’s .NET Framework, Microsoft SQL Server and XSLT (it’s an XML based language for transformation of XML documents). This is designed in such a way that it supports a high level of flexibility in customization, easy to integrate the existing technologies with lesser effort. We can use ASP.NET user controls, master pages, Membership role providers etc with Umbraco.
Upon working with this CMS in couple of projects, I can say that it’s a very simple and flexible CMS which can cater to the needs of content editors, developers and designers individually. It’s very easy to set up and run an Umbraco installation, step by step installation notes have been provided in the Umbraco site. The major advantage which I felt was rapid Web site development, content editors, designers and developers can work in parallel which can ensure a rapid delivery of the project. Microsoft has stated Umbraco as one among the top five popular downloads via Microsoft Web platform installer.
Do check the Umbraco site for more information http://umbraco.org/ . Keep watching my blog on more posts in Umbraco.

Installing ASP.NET MVC

Installing ASP.NET MVC Before we dive deep into the ASP.NET MVC, let’s install it our development machine. This is very straight forwa...