Wednesday, September 9, 2009

Using Stylesheets in XML- CSS & XSLT

XML is a means of exchanging data between applications. It allows the developers to describe and structure their data in their own formats. As the XML gave more emphasis on data rather than formatting, the data in the XML document can be formatted in two ways:

  • USING CSS
  • USING XSL

Cascade Style Sheet( CSS):


Initially, Cascading Style sheets (CSS) were used for formatting the data in the XML documents. It allows the Web Developers to define a formatting for the elements in XML and the same can be applied to as many documents you like. The advantages are:

  • It has a Precise control over presentation
  • It is Resolution Independent
  • It downloads Faster
  • It is easy to maintain

Though it has a lot of advantages it also has following disadvantages.

  • The order of elements for display cannot be changed
  • An element cannot be processed more than once
  • Generated text cannot be added to the presentation

Extensible Stylesheet Language (XSL):


The difficulties that were encountered with CSS were removed by making use of XSL. XSL is an application of XML It allows you to create high performance XML based systems by integrating Server side XML processing’s. The need for transforming data from one format to the other results in splitting XSL into two groups:

  1. XSLT – It describes how to transform XML. Document into other formats.
  2. XSL-FO- It describes formatting details of each element in the XML document.

XSLT:


The XML Style sheet Language Transformation (XSLT) is a mechanism of transforming one form of XML documents to the other form. It is a set of templates based on Xpath expressions that tells how to fetch a particular node from the XML documents. It is a part of XSL, which is a style sheet language for XML. XSLT is widely used in Websites Content Management to convert XML into HTML pages. It uses Xpath to define parts that match one or more templates. Xpath is an query language that allows you to identify the nodes. It can select nodes in any direction. An XSLT processor is used to perform transformations of XML document in to other formats based on the given XSLT document.



XSL_FO:


XSL-FO means Extensible Formatting Objects. There are two different ways in which the XML document can be formatted. They are:

  • Layout Based formatting
  • Content Based formatting

In a layout based formatting, the limitations of the target may constrain the content or appearance on the page, whereas in a Content Based Formatting, the target medium is generated to accommodate the information being formatted. The XSL FO allows you to make formatting and styling options to your document.

0 comments:

Popular Posts

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP