IBM Version 5 Manual De Usuario

Descargar
Página de 340
 Chapter 2. Technologies in XML 
21
2.3  Schema and style using CSS, XSLT, and XSL
The eXtensible Style Language (XSL) is a language defined by the W3C for 
expressing stylesheets. It has three parts:
򐂰
XSL Transformations (XSLT), which is used for transforming XML documents.
򐂰
the XML Path Language (XPath), which is a language used to access or refer 
to parts of an XML document. 
򐂰
XSL-FO, which is a vocabulary for specifying formatting semantics. 
A transformation in XSLT must be well-formed document and must conform to 
the namespaces in XML, which can contain elements that may or may not be 
defined by XSLT. XSLT-defined elements belong to a specific XML namespace. A 
transformation in XSLT is called a stylesheet. 
XSL uses a XML notation and works on two principles: pattern matching and 
templates. It operates on an XML source document and parses it into a source 
tree, it specifies the tansformation of the source tree to a result tree, and then it 
outputs the result tree to a specified format. In constructing the result tree, the 
elements can be reordered or filtered and also other structures can be added. 
The result tree can be completely different from the source tree. 
A stylesheet contains a set of template rules. A rule consists of two parts. The 
first is a pattern that matches against nodes in the source tree, and the second is 
a template, which is instantiated to form part of the tree. Therefore, documents 
that have similar source tree structures can use one stylesheet.
The result tree is constructed by finding the template rule for the root node and 
instantiating its template. This creates part of the tree. The template, in turn, can 
contain elements from XSLT namespaces that are instructions for creating parts 
of the tree. Each instruction in the template is carried out and that instruction 
would result in a part of the tree being created. When the transformer is looking 
for a applicable template rule, it may find more than one that matches it for an 
element. Since only one rule can be applied, conflict resolution rules will be 
applied. The rules are a combination of import precedence and priority. If the 
transformer cannot resolve the conflict, it will signal an error.
XSLT makes use of the expressing language defined by XPath for deciding 
elements for processing and generating text. 
XSL transformation can be carried out either on a client or a server. On the client 
side, Javascript could be used to determine the browser type of any operating 
system characteristics and then applying different style sheets according to 
browser and user needs. Obviously, the browser must support an XML parser.