XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents.

  • Published on
    15-Jan-2016

  • View
    34

  • Download
    0

DESCRIPTION

XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based Stylesheet Language. CSS = Style Sheets for HTML - PowerPoint PPT Presentation

Transcript

  • XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents.

    The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based Stylesheet Language.

  • CSS = Style Sheets for HTMLHTML uses predefined tags, and the meaning of each tag is well understood.The tag in HTML defines a table - and a browser knows how to display it.Adding styles to HTML elements are simple. Telling a browser to display an element in a special font or color, is easy with CSS.

  • XSL = Style Sheets for XMLXML does not use predefined tags (we can use any tag-names we like), and therefore the meaning of each tag is not well understood.A tag could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.XSL describes how the XML document should be displayed!

  • XSL consists of three parts:XSLT - a language for transforming XML documents XPath - a language for navigating in XML documents XSL-FO - a language for formatting XML documents

  • XSLT = XSL TransformationsXSLT is the most important part of XSL.

    XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.

    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.

    A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree

  • XSLT Uses XPathXSLT uses XPath to find information in an XML document. XPath is used to navigate through elements and attributes in XML documents.

    XPath is used to navigate through elements and attributes in an XML document.

    In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.

  • Style Sheet DeclarationThe root element that declares the document to be an XSL style sheet is or .Note: and are completely synonymous and either can be used!The correct way to declare an XSL style sheet according to the W3C XSLT Recommendation is:or:The xmlns:xsl="http://www.w3.org/1999/XSL/Transform" points to the official W3C XSLT namespace. If you use this namespace, you must also include the attribute version="1.0

  • We want to transform the following XML document ("cdcatalog.xml") into XHTML: Lagaan Amir Khan India Amir Khan Productions 10.90 2001 . .

  • Link the XSL Style Sheet to the XML DocumentAdd the XSL style sheet reference to your XML document ("cdcatalog.xml"): Lagaan Amir Khan India Amir Khan Productions 10.90 2001 . .

  • Then you create an XSL Style Sheet ("cdcatalog.xsl") with a transformation template: My CD Collection Title Artist

  • Since an XSL style sheet is an XML document, it always begins with the XML declaration: .The next element, , defines that this document is an XSLT style sheet document (along with the version number and XSLT namespace attributes).The element defines a template. The match="/" attribute associates the template with the root of the XML source document.The content inside the element defines some HTML to write to the output.

  • The Element

    The element can be used to extract the value of an XML element and add it to the output stream of the transformation:

  • The element allows you to do looping in XSLT.The XSL element can be used to select every XML element of a specified node-set:

  • Filtering the OutputWe can also filter the output from the XML file by adding a criterion to the select attribute in the element.

    Legal filter operators are:= (equal) != (not equal) < less than > greater than

  • The ElementTo put a conditional if test against the content of the XML file, add an element to the XSL document.

  • What is XHTML?

    XHTML documents are XML conforming. As such, they are readily viewed, edited, and validated with standard XML tools. XHTML documents can be written to operate as well or better than they did before in existing HTML 4-conforming user agents as well as in new, XHTML 1.0 conforming user agents.

    XHTML documents can utilize applications (e.g. scripts and applets) that rely upon either the HTML Document Object Model or the XML Document Object Model [DOM].

  • XHTML stands for EXtensible HyperText Markup LanguageXHTML is a combination of HTML and XML (EXtensible Markup Language).XHTML consists of all the elements in HTML 4.01, combined with the strict syntax of XML.

  • XML is a markup language where everything must be marked up correctly, which results in "well-formed" documents.XML is designed to describe data, and HTML is designed to display data.Today's market consists of different browser technologies, some browsers run on computers, and some browsers run on mobile phones or other small devices. The last-mentioned do not have the resources or power to interpret a "bad" markup language.Therefore - by combining the strengths of HTML and XML, W3C recommended a markup language that is useful now and in the future - XHTML.

  • Displaying XML with XSLTXSLT is the recommended style sheet language of XML.XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.XSLT can be used to transform XML into HTML, before it is displayed by a browser:

  • ISO-8859-1ISO-8859-1 is the default character set in most browsers.The first 128 characters of ISO-8859-1 is the original ASCII character-set (the numbers from 0-9, the uppercase and lowercase English alphabet, and some special characters).The higher part of ISO-8859-1 (codes from 160-255) contains the characters used in Western European countries and some commonly used special characters.Entities are used to implement reserved characters or to express characters that cannot easily be entered with the keyboard.

  • XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents.XSLT stands for XSL Transformations.

  • It started with XSL and ended up with XSLT, XPath, and XSL-FO.It Started with XSLXSL stands for EXtensible Stylesheet Language.The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based Stylesheet Language. CSS = Style Sheets for HTMLHTML uses predefined tags, and the meaning of each tag is well understood.The tag in HTML defines a table - and a browser knows how to display it.Adding styles to HTML elements are simple. Telling a browser to display an element in a special font or color, is easy with CSS.XSL = Style Sheets for XMLXML does not use predefined tags (we can use any tag-names we like), and therefore the meaning of each tag is not well understood.A tag in XML could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.

  • XSL describes how the XML document should be displayed!XSL - More Than a Style Sheet LanguageXSL consists of three parts:XSLT - a language for transforming XML documentsXPath - a language for navigating in XML documentsXSL-FO - a language for formatting XML documents

Recommended

View more >