Beginning XML - Part II (XML Style Language)

Written by Amrit Hallan

In order to work with XML, it becomes necessary to know a little aboutrepparttar XML Style Language.

XSL provides for two forms of output flow objects. The first set isrepparttar 118048 set of displayable objects defined for HTML, which allows XML data to be mapped into HTML-aware browsers. The second set is based onrepparttar 118049 DSSSL-O specifications (Document Style Semantics and Specification Language - Online), and allows XML data to be mapped to DSSSL-based text formatters, such as JADE. Both sets of flow objects are described using XML markup.

XSL defines a set of rules which define a set of actions that are to be associated with various patterns of target elements. The selection of target elements can be qualified in a number of ways. For example, XSL allows different rules to be applied torepparttar 118050 same element type dependent on what its ancestors, siblings or contents are. In addition, processing rules can be specified for application when particular attribute values have been associated with an element, or whenrepparttar 118051 element has specific contents. This means that specific rules can be applied to elements with unique identifiers or identified content types (classes).

XSL allows forrepparttar 118052 definition of sharable sets of style rules. A style rule applies a set of processing characteristics to a target element without creating a new flow object. Whererepparttar 118053 same style is to be applied to a number of elements, a uniquely named style can be defined for future reference. This provides XSL withrepparttar 118054 facilities for creating cascading sets of style sheet specifications similar in effect to those defined inrepparttar 118055 more limited Cascading Style Sheet specification used to process HTML documents.

XSL style sheets can userepparttar 118056 ECMAScript programming language to evaluaterepparttar 118057 contents of elements or attributes prior to or duringrepparttar 118058 creation of flow objects. ECMAScript is a variant of JavaScript and Jscript that has been formally defined byrepparttar 118059 European Computer Manufacturers Association. It allows tools containing a Java Virtual Machine to process data contained within an XML document. The language has been designed to support only a limited set of processing side-effects to ensure that evaluation cannot inhibitrepparttar 118060 progressive rendering of large documents.

Now coming back to XML, it was originally developed to allow structured documents ofrepparttar 118061 type typically encoded in SGML to be delivered overrepparttar 118062 Internet as an integrated part ofrepparttar 118063 World Wide Web of documents. Typically these documents requirerepparttar 118064 specification of element types over and above those permitted in HTML (e.g. specific elements for parts number and other forms of article identification, prices and other forms of calculable measurements, and special classes of displayable text such as health warnings and controlled task lists). XML allows users to define their own sets of document elements and describe how each of these elements should be displayed on a screen in conformance withrepparttar 118065 supplier's house style.

Beginning XML - Part III (Building Blocks)

Written by Amrit Hallan

XML documents (and HTML documents) are made up byrepparttar following building blocks:

Elements Tags Attributes Entities PCDATA CDATA

This is a brief explanation of each ofrepparttar 118047 building blocks:


Elements arerepparttar 118048 main building blocks of both XML and HTML documents.

Examples of HTML elements are "body" and "table". Examples of XML elements could be "my-schedule" and "date". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".


Tags are used to markup elements.

A starting tag like mark uprepparttar 118049 beginning of an element, and an ending tag like mark uprepparttar 118050 end of an element.


A body element: body text in between. A message element: some message in between


Attributes provide extra information about elements.

Attributes are placed insiderepparttar 118051 start tag of an element. Attributes come in name/value pairs. The following "img" element has an additional information about a source file:

The name ofrepparttar 118052 element is "img". The name ofrepparttar 118053 attribute is "src". The value ofrepparttar 118054 attribute is "computer.gif". Sincerepparttar 118055 element itself is empty it is closed by a " /".


PCDATA means parsed character data.

Think of character data asrepparttar 118056 text found betweenrepparttar 118057 start tag andrepparttar 118058 end tag of an XML element.

PCDATA is text that will be parsed by a parser. Tags insiderepparttar 118059 text will be treated as markup and entities will be expanded.


CDATA also means character data.

CDATA is text that will NOT be parsed by a parser. Tags insiderepparttar 118060 text will NOT be treated as markup and entities will not be expanded.


Entities as variables used to define common text. Entity references are references to entities.

Most of you will knownrepparttar 118061 HTML entity reference: " " that is used to insert an extra space in an HTML document. Entities are expanded when a document is parsed by an XML parser.

Cont'd on page 2 ==> © 2005
Terms of Use