Cover Pages Logo SEARCH
Advanced Search
Site Map
CP RSS Channel
Contact Us
Sponsoring CP
About Our Sponsors

Cover Stories
Articles & Papers
Press Releases

XML Query

XML Applications
General Apps
Government Apps
Academic Apps

Technology and Society
Tech Topics
Related Standards

The XSL Companion, by Neil Bradley

The XSL Companion

By Neil Bradley

The XSL Companion: Styling XML Documents. By Neil Bradley. London/New York: Addison-Wesley/Pearson Education, [May] 2000. ISBN: 0-201-67487-4. xiv + 318 pages.

Book Information from the Publisher

A concise, comprehensive and accessible guide to the scope, strengths and limitations of the XSL (eXtensible Stylesheet Language) family of stylesheet standards for XML, this book explains the practical ways in which XSL can be utilized for formatting and manipulating information held in the hugely popular XML data format.

The huge expansion in usage of XML created the need for a powerful standard for formatting and transforming XML documents - the XSL standard, which developed into the family of three specific standards exaimned in detail in this book. XSL enables the further expansion of XML technology into new domains of content management, audience targeted presentation and distributed document processing.

If you are a current or potential XML user looking for just one reference to get you up to speed on styling and manipulating your XML documents with clarity, comprehensive coverage and precision, then this book will be your essential and constant companion.

This book covers in detail the family of three separate stylesheet which make up XSL:

  • XPath locates specific information within XML Documents

  • XSLT transforms XML documents into other data formats

  • XSL embeds formatting information in XML documents

Together these form a powerful array of tools that allow you to control and optimize the formatting of your XML documents, and thus deliver content and information in a dynamic and flexible way.


This book covers a family of standards developed by W3C (the World Wide Web Consortium). These standards emerged out of a proposal for a stylesheet language, submitted in 1997, which was to be called 'XSL' (eXtensible Stylesheet Language). However, during its gestation, this proposal was eventually pulled apart into three separate standards. The first of these, XPath, defines a mechanism for locating information in XML documents, and it has many other uses beyond its role in formatting documents. The second, XSLT, provides a means for transforming XML documents into other data formats, including (but not limited to) formatting languages. Finally, the term 'XSL is now properly used only to name a proposed standard for embedding formatting information in documents using XML elements.

These three standards are still related. Together, they provide a means to format XML documents. The XSLT standard includes XPath constructs in a number of places, and XSLT can be used to convert an XML document into an XSL document. But each can be used alone, or with alternative technologies. As the XSL formatting language is less mature than XSLT, and not yet well supported, it is recognised that XSLT will initially be used primarily to convert XML documents into HTML documents, possibly enhanced with CSS styling instructions. Both these formats are therefore explained in depth. However, the first half of this book concentrates on using XSLT as a general tool for processing XML, and the way that it uses XPath to find and manipulate components of an XML document.

Table of Contents

Preface v
Chapter 1 Using this book 1
Book structure 1
Style conventions 1
Chapter 2 Overview 3
Stylesheets 3
The XSL standards 5
XSL/XSLT processors 8
Why XSL? 9
Stylesheet example 10
Transformations (XSLT)
Chapter 3 Templates 13
Template concepts 13
Values of elements and attributes 21
Breaking well-formed constraints 22
XSL format output 24
XML transformation output 24
Chapter 4 Stylesheets 27
Using stylesheets 27
The Stylesheet element 29
Fragmented stylesheets 31
Embedded stylesheets 34
Stylesheet contents 35
Output formats 36
Space preservation 38
Chapter 5 HTML output 41
Pseudo HTML output 41
True HTML output 43
Chapter 6 Contextual formatting 47
XML structures 47
Expressions 48
Alternative elements 49
Simple location contexts 50
Advanced context 52
Attribute contexts 53
Priorities 54
Chapter 7 Expressions in attributes 57
Template markup 57
Copy-through attributes 59
Element content to attribute 59
Child element to attribute 60
Chapter 8 Choices 61
Introduction 61
If conditions 61
Multiple choices 64
Chapter 9 Sorting 67
Simple element sorting 67
Correct ordering 68
Ordering options 70
Selective sorting 71
Multiple sort criteria 72
Chapter 10 Numbering 75
HTML numbering 75
Simple numbering 76
Expression values 78
Elements to count 79
Multipart numbering 82
Document-wide numbering 84
Advanced formatting options 85
Chapter 11 Reorganizing material 87
Information reuse 87
Context-specific formatting (modes) 89
Moving information 90
Accessing remote documents 91
Chapter 12 XML output 95
XML output format 95
Elements 95
Attributes 97
Text 99
Comments 100
Processing instructions 101
Copying source structures 103
Chapter 13 Identifiers and links 105
XML IDs 105
Keys 106
Hypertext links 110
Chapter 14 Text format 113
Non-XML output 113
Text output mode 115
Line-ending issues 116
Chapter 15 Namespaces 119
Namespaces in stylesheets 119
Namespaces in input documents 122
Namespaces in output documents 123
Outputting stylesheets (aliases) 126
Chapter 16 Productivity features 129
Variables 129
Attribute sets 133
Named templates 134
Single-template short-cut 137
Direct processing 137
Messages 140
Chapter 17 XSL 143
Background 143
XSL instructions 144
Templates and content 145
Pages 147
Page sequences 150
Page regions 156
Content 162
Blocks 164
Lines 174
In-line objects 177
Object positioning 185
Out-of-line objects 186
Neutral objects 188
Whitespace and line feeds 191
Aural styles 193
Chapter 18 HTML 4.0 199
HTML 199
HTML versions 200
Basic document structure 201
Differences from XIVIL 203
Text blocks 204
Basic hypertext links 204
Common attributes 206
Headings and Divisions 208
Lists 210
In-line elements 212
Formatted text 214
Images 215
Tables 217
Descriptive markup 223
Styles and scripts 224
Frames 225
Elements and attributes list 228
Chapter 19 css 237
Background 237
Format primer 238
CSS versus XSL/XSLT 239
Relevance to XSLT and XSL 239
Rule constructions 240
Properties 242
Chapter 20 Expressions 249
The XPath standard 249
Expressions in attributes 249
Patterns 250
Location paths 253
Expressions 256
Data types and functions 257
Operators 264
Predicate filters 268
XSLT extensions 270
Chapter 21 DTD analysis 277
Introduction 277
Elements to style 278
Hierarchical context 279
Required and sequential context 279
Block and in-line elements 280
Attributes 281
DTD construction features 282
Chapter 22 XSLT DTD 285
Introduction 285
Top-level elements 285
Templates 290
Template instructions 292
Instruction constructs 302
Result elements 305
Chapter 23 XSLT extensions 307
Extension functions 307
Extension elements 308
Forward compatibility 310
Index 311


Prepared by Robin Cover for The XML Cover Pages archive.

Globe Image

Document URL: