Cover image for Inside XSLT
Inside XSLT
Holzner, Steven.
Personal Author:
First edition.
Publication Information:
Indianapolis, IN : New Riders, [2002]

Physical Description:
xix, 616 pages : illustrations ; 24 cm
General Note:
Includes index.
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.73.X58 H65 2002 Adult Non-Fiction Central Closed Stacks

On Order



A comprehensive guide for XML programmers using XSLT. It contains hundreds of examples. A companion website includes all of the code developed in the book.

Author Notes

Steven Holzner is an award-winning author who has been writing about XML topics, such as XSLT, as long as they've been around. He's written 67 books, all on programming topics, and selling well over a million copies. His books have been translated into 16 languages around the world and include a good number of industry bestsellers. He's a former contributing editor of PC Magazine, graduated from MIT, and received his Ph.D. at Cornell. He's been on the faculty of both MIT and Cornell, and also teaches corporate seminars around the country.

These reviewers contributed their considerable hands-on expertise to the entire development process for Inside XSLT. As the book was being written, these dedicated professionals reviewed all the material for technical content, organization, and flow. Their feedback was critical to ensuring that Inside XSLT fits our reader's need for the highest quality technical information.

Jason A. Buss is a programmer/analyst, developing single-source publishing solutions for a leading aircraft manufacturer in the Midwest. He is married with four children (not including himself). In his spare time, he enjoys playing with his children, upgrading and working with his home PC (he is currently developing his mastery with FreeBSD), reading, playing guitar, and enjoying live music. He can be admired, lauded, cursed, or otherwise reached at

Darrin Bishop is a consultant for Levi, Ray and Shoup, Inc., an information technology firm located in the Midwest. He is currently the product architect for a large project that is leveraging XML technologies. The product architect role includes managing the architectural design and researching technologies and technical issues to support the project. Darrin's past projects include a real-estate title Web application, a pension product, and various support applications. His current technical focus is using HTTP and XML to bridge disparate systems.

Reviews 1

Library Journal Review

One of the supporting cast of standards for XML, Extensible Stylesheet Language Transformation (XSLT) applies the formatting and transformation capabilities to the content that XML defines. In this comprehensive resource, Holzner, a recognized XML specialist, first covers prerequisite topics, then quickly gets to the meat of his subject. He sufficiently presents parse trees, nodes types, how to use XSLT with a programming language, and XML Path Language. Perhaps the most complex and ubiquitous portion of XSLT is the pattern matching capabilities, and the author, thankfully, spends several chapters explaining it. Holzner's only assumption here is that readers have some knowledge of XML and HTML. Highly recommended for libraries serving programmers. (c) Copyright 2010. Library Journals LLC, a wholly owned subsidiary of Media Source, Inc. No redistribution permitted.

Table of Contents

1 Essential XSLTp. 1
A Little Backgroundp. 2
XML Documentsp. 6
What Does XML Look Like in a Browser?p. 11
XSLT Transformationsp. 12
Making an XSLT Transformation Happenp. 15
Using Standalone XSLT Processorsp. 16
Using Browsers to Transform XML Documentsp. 23
Using XSLT and JavaScript in the Internet Explorerp. 26
XSLT Transformations on Web Serversp. 27
XML-to-XML Transformationsp. 29
XML-to-XHTML Transformationsp. 32
XSLT Resourcesp. 35
XSL Formatting Objects: XSL-FOp. 41
XSL-FO Resourcesp. 41
Formatting an XML Documentp. 42
The XSLT Stylesheetp. 43
Transforming a Document into Formatting Object Formp. 45
Creating a Formatted Documentp. 48
2 Creating and Using Stylesheetsp. 51
Trees and Nodesp. 51
The Information Set Model Versus the XSLT Tree Modelp. 57
Working with XSLT Elementsp. 58
The [left angle bracket]?xsl:stylesheet?[right angle bracket] Processing Instructionp. 59
The [left angle bracket]xsl:stylesheet[right angle bracket] Elementp. 60
Top-Level Stylesheet Elementsp. 63
The [left angle bracket]xsl:template[right angle bracket] Elementp. 65
Template Bodiesp. 65
The [left angle bracket]xsl:apply-templates[right angle bracket] Elementp. 69
Accessing Node Valuesp. 72
XML Base Supportp. 77
Choosing Output Methodsp. 78
Simplified Stylesheetsp. 85
Embedded Stylesheetsp. 86
The [left angle bracket]xsl:include[right angle bracket] Elementp. 89
The [left angle bracket]xsl:import[right angle bracket] Elementp. 91
The [left angle bracket]xsl:apply-imports[right angle bracket] Elementp. 92
Using Internet Explorer to Transform XML Documentsp. 94
3 Creating and Using Templatesp. 97
Creating a Templatep. 97
Processing Child Nodesp. 99
Accessing Node Valuesp. 101
Creating Match Patternsp. 102
Selecting Which Template to Applyp. 103
Reading Attribute Valuesp. 107
The [left angle bracket]xsl:text[right angle bracket] Elementp. 109
Disabling Output Escapingp. 111
Writing Attribute Valuesp. 114
Attribute Value Templatesp. 115
Handling Whitespacep. 117
The [left angle bracket]xsl:strip-space[right angle bracket] and [left angle bracket]xsl:preserve-space[right angle bracket] Elementsp. 119
Automatic Indentingp. 120
Default Template Rulesp. 124
Deleting Contentp. 127
Template Conflict Resolutionp. 128
The [left angle bracket]xsl:copy[right angle bracket] Elementp. 131
The [left angle bracket]xsl:copy-of[right angle bracket] Elementp. 134
The [left angle bracket]xsl:message[right angle bracket] Elementp. 135
4 Creating Match Patternsp. 139
Matching the Root Nodep. 141
Matching Elementsp. 141
Matching Childrenp. 141
Matching Element Descendantsp. 142
Matching Attributesp. 142
Formally Defining Match Patternsp. 144
Part 1 of Step Patterns: Pattern Axesp. 147
Part 2 of Step Patterns: Node Testsp. 150
Part 3 of Step Patterns: Predicatesp. 155
Creating Predicatesp. 158
Matching by IDp. 170
Matching by Keyp. 171
Using the Or Operatorp. 173
Pattern Examplesp. 175
5 Making Choices and Sorting Datap. 185
The [left angle bracket]xsl:if[right angle bracket] Elementp. 186
The [left angle bracket]xsl:choose[right angle bracket], [left angle bracket]xsl:when[right angle bracket], and [left angle bracket]xsl:otherwise[right angle bracket] Elementsp. 190
The [left angle bracket]xsl:for-each[right angle bracket] Elementp. 198
Sorting Elementsp. 202
The [left angle bracket]xsl:number[right angle bracket] Elementp. 207
XSLT Extensibilityp. 216
Extension Functionsp. 218
Extension Elementsp. 227
The [left angle bracket]xsl:fallback[right angle bracket] Elementp. 229
6 Transforming from XML to XML, HTML, XHTML, RTF, and Modifying Document Contentp. 231
The [left angle bracket]xsl:output[right angle bracket] Elementp. 233
Altering Document Structure Based on Inputp. 250
The [left angle bracket]xsl:element[right angle bracket] Element: Creating New Elements at Run Timep. 250
The [left angle bracket]xsl:attribute[right angle bracket] Element: Creating New Attributesp. 253
The [left angle bracket]xsl:comment[right angle bracket] Element: Generating Commentsp. 255
The [left angle bracket]xsl:processing-instruction[right angle bracket] Element: Generating Processing Instructionsp. 256
The [left angle bracket]xsl:document[right angle bracket] Element: Generating Multiple Output Documentsp. 258
The [left angle bracket]xsl:namespace[right angle bracket] Element: Generating Namespace Declarationsp. 260
The [left angle bracket]xsl:attribute-set[right angle bracket] Element: Generating Attribute Setsp. 261
Omitting the XML Declaration and Generating XML Fragmentsp. 263
Using generate-id to Create Unique Identifiersp. 265
Creating CDATA Sectionsp. 269
Setting Character Encodingp. 271
Modes: Context-Specific Formattingp. 272
7 Using and Understanding XPathp. 281
Understanding XPathp. 283
XPath Data Typesp. 286
Creating XPath Location Pathsp. 296
Part 1 of XPath Location Steps: Axesp. 297
Part 2 of XPath Location Steps: Node Testsp. 298
Part 3 of XPath Location Steps: Predicatesp. 299
Using the XPath Axesp. 300
Using the ancestor Axisp. 300
Using the ancestor-or-self Axisp. 301
Using the descendant Axisp. 302
Using the descendant-or-self Axisp. 304
Using the following Axisp. 305
Using the following-sibling Axisp. 306
Using the namespace Axisp. 307
Using the parent Axisp. 309
Using the preceding Axisp. 310
Using the preceding-sibling Axisp. 311
Using the self Axisp. 313
Location Path Examplesp. 314
XPath Abbreviated Syntaxp. 315
Checking XPath Expressionsp. 316
XPath 2.0p. 317
8 Using the XSLT and XPath Functionsp. 321
The XSLT Functionsp. 323
The XPath Node Set Functionsp. 342
The XPath String Functionsp. 349
The XPath Number Functionsp. 363
The XPath Boolean Functionsp. 366
The [left angle bracket]xsl:decimal-format[right angle bracket] Element: Creating Numeric Formatsp. 371
New Functions in XSLT and XPath 2.0p. 374
9 Named Templates, Parameters, and Variablesp. 377
The [left angle bracket]xsl:variable[right angle bracket] Element: Creating Variablesp. 378
The [left angle bracket]xsl:call-template[right angle bracket] Element: Using Named Templatesp. 387
The [left angle bracket]xsl:param[right angle bracket] and [left angle bracket]xsl:with-param[right angle bracket] Elements: Creating Parametersp. 390
The [left angle bracket]xsl:key[right angle bracket] Element: Matching by Keyp. 401
The [left angle bracket]xsl:document[right angle bracket] Element: Generating Multiple Result Documentsp. 407
The [left angle bracket]xsl:namespace-alias[right angle bracket] Element: Generating Stylesheetsp. 411
10 Using XSLT Processor APIsp. 415
XSLT and JavaScript in the Internet Explorerp. 416
Handling Parsing Errorsp. 418
Internet Explorer and Dynamic Stylesp. 421
Internet Explorer and XML Data Islandsp. 427
Calling Java Directly from XSLT Processorsp. 429
Interfacing to XSLT Java APIsp. 431
Interfacing Xalan to Javap. 432
Interfacing Saxon to Javap. 435
Interfacing the Oracle XSLT Processor to Javap. 438
Interfacing XT to Javap. 442
Transforming XML to SQL-Based Databasesp. 445
Using XSLT with Active Server Pagesp. 449
Using XSLT with Java Server Pagesp. 452
Using XSLT with Java Servletsp. 454
11 Using XSLT to Create XSL-FO Documents: Text and Tablesp. 457
XSL Formattingp. 457
The XSL-FO Formatting Objectsp. 459
The XSL-FO Formatting Propertiesp. 463
Formatting an XML Documentp. 471
Using an XSLT Stylesheet to Transform to XSL-FOp. 473
Creating the Document Root: [left angle bracket]fo:root[right angle bracket]p. 479
Creating the Master Set Layout: [left angle bracket]fo:layout-master-set[right angle bracket]p. 480
Creating a Page Master: [left angle bracket]fo:simple-page-master[right angle bracket]p. 481
Creating Regionsp. 482
Creating Page Sequences: [left angle bracket]fo:page-sequence[right angle bracket]p. 484
Creating Flows: [left angle bracket]fo:flows[right angle bracket]p. 485
Creating Block-Level Content: [left angle bracket]fo:block[right angle bracket]p. 486
Creating Tablesp. 490
Creating Tables: [left angle bracket]fo:table[right angle bracket]p. 497
Creating Table Columns: [left angle bracket]fo:table-column[right angle bracket]p. 498
Creating Table Bodies: [left angle bracket]fo:table-body[right angle bracket]p. 499
Creating Table Rows: [left angle bracket]fo:table-row[right angle bracket]p. 500
Creating Table Cells: [left angle bracket]fo:table-cell[right angle bracket]p. 502
12 Using XSLT to Create XSL-FO Documents: Lists, Images, Columns, and Positioningp. 505
Creating XSL-FO Listsp. 505
Positioning Text with Block Containers: [left angle bracket]fo:block-container[right angle bracket]p. 514
Inline-Level Formatting Objectsp. 520
Creating Footnotes: [left angle bracket]fo:footnote[right angle bracket] and [left angle bracket]fo:footnote-body[right angle bracket]p. 529
Creating Links: [left angle bracket]fo:basic-link[right angle bracket]p. 532
Creating Columnsp. 536
Page Sequences and Page Numberingp. 538
A The XSLT DTDp. 549
DTD Fragment for XSLT Stylesheets (Non-Normative)p. 551
B XSL-FO Formatting Propertiesp. 559
Indexp. 577