0% found this document useful (0 votes)
70 views

XSL/XSLT

XSL/XSLT is an XML-based language used to style and transform XML documents. It has three main parts - XSLT for transforming XML, XPath for navigating XML, and XSL-FO for formatting XML. An XSLT stylesheet defines transformation rules that are applied to an XML document by an XSLT processor to generate output in XML, HTML, or text format.

Uploaded by

Khagesh Josh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

XSL/XSLT

XSL/XSLT is an XML-based language used to style and transform XML documents. It has three main parts - XSLT for transforming XML, XPath for navigating XML, and XSL-FO for formatting XML. An XSLT stylesheet defines transformation rules that are applied to an XML document by an XSLT processor to generate output in XML, HTML, or text format.

Uploaded by

Khagesh Josh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

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.
XML DOM

 A DOM defines a standard way for accessing and manipulating documents.


 The XML DOM views an XML document as a tree-structure.
 All element can accessed through the DOM tree.
 Their elements can be modified or deleted and new elements can be created.
 The elements, their text and their attributes are all known as nodes.
 The nodes of every document are organized in tree structure called DOM tree
DOM XML
Advantages of DOM XML

 XML DOM is language and platform independent.


 XML DOM is traversable - Information in XML DOM is organized in a
hierarchy which allows developer to navigate around the hierarchy looking for
specific information.
 XML DOM is modifiable - It is dynamic in nature providing the developer a
scope to add, edit, move or remove nodes at any point on the tree
Disadvantages of XML DOM

 It consumes more memory (if the XML structure is large) as program written once
remains in memory all the time until and unless removed explicitly.
 Due to the extensive usage of memory, its operational speed, compared to SAX is
slower.
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.
SAX vs DOM

You might also like