You are on page 1of 9

XSL/XSLT

XSL

► XSL which stands for EXtensible Stylesheet Language.


► It is similar to XML as CSS is to HTML.
► Tags are predefined in HTML but in case of XML documents, tags are not
predefined.
► In order to understand and style an XML document, World Wide Web Consortium
(W3C) developed XSL which can act as XML based Stylesheet Language.
► An XSL document specifies how a browser should render an XML document.
► XSL describes how the XML elements should be displayed.
The main parts of XSL

► XSLT − used to transform XML document into various other types of document.
► XPath − used to navigate XML document.
► XSL-FO − used to format XML document
What is XSLT
► XSLT, Extensible Stylesheet Language Transformations, provides the ability to transform
XML data from one format to another automatically.
► An XSLT stylesheet is used to define the transformation rules to be applied on the target XML
document.
► XSLT stylesheet is written in XML format.
► XSLT Processor takes the XSLT stylesheet and applies the transformation rules on the target
XML document and then it generates a formatted document in the form of XML, HTML, or
text format.
► This formatted document is then utilized by XSLT formatter to generate the actual output
which is to be displayed to the end-user.
How it works
Advantages

► Independent of programming. Transformations are written in a separate xsl file


which is again an XML document.
► Output can be altered by simply modifying the transformations in xsl file. No need
to change any code. So Web designers can edit the stylesheet and can see the
change in the output quickly
Xpath

► XPath uses path expressions to select nodes or node-sets in an XML document.


► XPath specification specifies seven types of nodes which can be the output of
execution of the XPath expression.
► Root
► Element
► Text
► Attribute
► Comment
► Processing Instruction
► Namespace
► XPath uses a path expression to select node or a list of nodes from an XML
document
XQuery

► XQuery is a functional language that is used to retrieve information stored in


XML format.
► XQuery can be used on XML documents, relational databases containing data in
XML formats, or XML Databases.
► XQuery 3.0 is a W3C recommendation from April 8, 2014X
► It is very widely implemented.
► It is powerful and easy to learn.
► XQuery is replacing complex Java or C++ programs with a few lines of code.
► XQuery is simpler to work with and easier to maintain than many other
alternatives.
SAX(Simple API for XML)

► SAX (Simple API for XML) is an application program interface (API) that allows a
programmer to interpret a Web file that uses the Extensible Markup Language (XML) -
that is, a Web file that describes a collection of data.
► SAX is an alternative to using the Document Object Model (DOM) to interpret the XML
file.
► As its name suggests, it's a simpler interface than DOM and is appropriate where many
or very large files are to be processed, but it contains fewer capabilities for manipulating
the data content.
► SAX is an event-driven interface
► SAX works directly with an XML parser.

You might also like