XML Tutorials - Herong's Tutorial Examples
∟XSL (Extensible Stylesheet Language) Introduction
∟What Is XSL (Extensible Stylesheet Language)
This section describes XSL (Extensible Stylesheet Language), which consists of 3 languages: XSLT (XSL Transformation), XPath (XML Path), and XSL-FO (XSL Formatting Objects) for defining XML document transformation and presentation.
What Is XSL (Extensible Stylesheet Language)?
XSL is a set of languages for defining XML document transformation and presentation with 3 parts:
- XSLT (XSL Transformations) - A language for defining XML document transformations
- XPath (XML Path) - A language to express parts of an XML document. XPath is used by XSLT to access
or refer different parts of an XML document.
- XSL-FO (XSL Formatting Objects) - A language for defining XML presentation on printed papers.
Here is the process of using XSLT and XPath together to perform an XML document generic transformation:
- Understand the structure and data differences between the original XML document and the resulting document.
- Write an stylesheet using the XSLT language to capture all transformation logics to cover those differences.
- Use the XPath when writing those transformation logics in the XSLT stylesheet to identify parts of the original XML document.
- Run an XSLT transformation program to apply the XLST stylesheet on the original XML document.
- Review the resulting document to see if it matches your expectation.
Here is how to add XSL-FO to the process to transform an original XML document to a special XML document formatted
for paper presentation, or printing:
- Understand the presentation requirements on printing pages.
- Write an stylesheet using the XSLT language to capture all transformation logics, which should mix
data from the original XML document identified with XPath expressions and XSL-FO formatting objects.
- Run an XSLT transformation program to apply the XLST stylesheet on the original XML document.
- Run an XSL-FO rendering program convert the resulting XML document into a printing document in PDF or PS format.
- Send the final PDF or PS document to a paper printer or screen reader.
Main features of XSL:
- 3 parts: XSLT, XPath and XSL-FO are independent from each other.
- XSLT is an XML based language.
- XPath is an expression language.
- XSL-FO is an XML based language.
- Simple XSLT stylesheets are very easy to get started.
- Complex XSLT stylesheets are very hard to write. Like Perl scripts, the XSLT processing rules
heavily depend on a hidden, and dynamically changing, context.
- XSL-FO supports all presentation functionalities supported by CSS, and more.
Table of Contents
About This Book
Introduction of XML (eXtensible Markup Language)
XML File Syntax
XML File Browsers
XML-JSON Document Conversion
DOM (Document Object Model) Programming Interface
SAX (Simple API for XML) Programming Interface
DTD (Document Type Definition) Introduction
Syntaxes of DTD Statements
Validating an XML Document against the Specified DTD Document Type
XSD (XML Schema Definition) Introduction
Syntaxes of XSD Statements
Validating XML Documents Against Specified XML Schemas
►XSL (Extensible Stylesheet Language) Introduction
►What Is XSL (Extensible Stylesheet Language)
"Hello world!" Example of XSLT
Web Browser Errors on Local XSL File
Java Implementation of XSLT
XSLT (XSL Transformations) Introduction
XPath (XML Path) Language
XSLT Elements as Programming Statements
Control and Generate XML Element in the Result
PHP Extensions for XML Manipulation
Processing XML with Python Scripts
XML Notepad - XML Editor
XML Tools Plugin for Notepad++
XML Plugin Packages for Atom Editor
XML 1.1 Changes and Parsing Examples
Archived Tutorials
References
Full Version in PDF/EPUB