Inside XSLT
About the Author
About the Technical Reviewers
Acknowledgments
Tell Us What You Think
Introduction
Whats Inside?
Who This Book Is For
At What Level This Book Is Written
Conventions Used
1. Essential XSLT
XSL = XSLT + XSL-FO
A Little Background
XML Documents
What Does XML Look Like in a Browser?
XSLT Transformations
Making an XSLT Transformation Happen
Using Standalone XSLT Processors
Using Browsers to Transform XML Documents
Using XSLT and JavaScript in the Internet Explorer
XSLT Transformations on Web Servers
XML-to-XML Transformations
XML-to-XHTML Transformations
XSLT Resources
XSL Formatting Objects: XSL-FO
XSL-FO Resources
Formatting an XML Document
The XSLT Stylesheet
Transforming a Document into Formatting Object Form
Creating a Formatted Document
2. Creating and Using Stylesheets
Trees and Nodes
The Information Set Model Versus the XSLT Tree Model
Working with XSLT Elements
The <?xsl:stylesheet?> Processing Instruction
The <xsl:stylesheet> Element
Top-Level Stylesheet Elements
The <xsl:template> Element
Template Bodies
The <xsl:apply-templates> Element
Accessing Node Values
XML Base Support
Choosing Output Methods
Simplified Stylesheets
Embedded Stylesheets
The <xsl:include> Element
The <xsl:import> Element
The <xsl: apply-imports > Element
Using Internet Explorer to Transform XML Documents
3. Creating and Using Templates
Creating a Template
Processing Child Nodes
Accessing Node Values
Creating Match Patterns
Selecting Which Template to Apply
Reading Attribute Values
The <xsl:text> Element
Disabling Output Escaping
Writing Attribute Values
Attribute Value Templates
Handling Whitespace
The <xsl: strip-space > and <xsl: preserve-space > Elements
Automatic Indenting
Default Template Rules
Deleting Content
Template Conflict Resolution
The <xsl:copy> Element
The <xsl:copy-of > Element
The <xsl:message> Element
4. Creating Match Patterns
Matching the Root Node
Matching Elements
Matching Children
Matching Element Descendants
Matching Attributes
Formally Defining Match Patterns
Part 1 of Step Patterns: Pattern Axes
Part 2 of Step Patterns: Node Tests
Part 3 of Step Patterns: Predicates
Creating Predicates
Matching by ID
Matching by Key
Using the Or Operator
Pattern Examples
5. Making Choices and Sorting Data
The <xsl:if> Element
The <xsl:choose>, <xsl:when>, and <xsl: otherwise > Elements
The <xsl:for-each> Element
Sorting Elements
The <xsl:number> Element
XSLT Extensibility
Extension Functions
Extension Elements
The <xsl:fallback> Element
6. Transforming from XML to XML, HTML, XHTML, RTF, and Modifying Document Content
The <xsl:output> Element
Altering Document Structure Based on Input
The <xsl:element> Element: Creating New Elements at Run Time
The <xsl:attribute> Element: Creating New Attributes
The <xsl:comment> Element: Generating Comments
The <xsl:processing-instruction> Element: Generating Processing Instructions
The <xsl:document> Element: Generating Multiple Output Documents
The <xsl:namespace> Element: Generating Namespace Declarations
The <xsl:attribute-set> Element: Generating Attribute Sets
Omitting the XML Declaration and Generating XML Fragments
Using generate-id to Create Unique Identifiers
Creating CDATA Sections
Setting Character Encoding
Modes: Context-Specific Formatting
7. Using and Understanding XPath
Understanding XPath
XPath Data Types
Creating XPath Location Paths
Part 1 of XPath Location Steps: Axes
Part 2 of XPath Location Steps: Node Tests
Part 3 of XPath Location Steps: Predicates
Using the XPath Axes
Using the ancestor Axis
Using the ancestor-or-self Axis
Using the descendant Axis
Using the descendant-or-self Axis
Using the following Axis
Using the following-sibling Axis
Using the namespace Axis
Using the parent Axis
Using the preceding Axis
Using the preceding-sibling Axis
Using the self Axis
Location Path Examples
XPath Abbreviated Syntax
Checking XPath Expressions
XPath 2.0
8. Using the XSLT and XPath Functions
The XSLT Functions
The XPath Node Set Functions
The XPath String Functions
The XPath Number Functions
The XPath Boolean Functions
The <xsl:decimal-format> Element: Creating Numeric Formats
New Functions in XSLT and XPath 2.0
9. Named Templates, Parameters, and Variables
The <xsl:variable> Element: Creating Variables
The <xsl:call-template> Element: Using Named Templates
The <xsl:param> and <xsl: with-param > Elements:Creating Parameters
Default Template Values
The <xsl:key> Element: Matching by Key
The <xsl:document> Element: Generating Multiple Result Documents
The <xsl: namespace-alias > Element: Generating Stylesheets
10. Using XSLT Processor APIs
XSLT and JavaScript in the Internet Explorer
Handling Parsing Errors
Internet Explorer and Dynamic Styles
Internet Explorer and XML Data Islands
Calling Java Directly from XSLT Processors
Interfacing to XSLT Java APIs
Interfacing Xalan to Java
Interfacing Saxon to Java
Interfacing the Oracle XSLT Processor to Java
Interfacing XT to Java
Transforming XML to SQL-Based Databases
Using XSLT with Active Server Pages
Using XSLT with Java Server Pages
Using XSLT with Java Servlets
11. XSL-FO Documents: Text and Tables
XSL Formatting
The XSL-FO Formatting Objects
The XSL-FO Formatting Properties
Formatting an XML Document
Using an XSLT Stylesheet to Transform to XSL-FO
Creating the Document Root: <fo:root>
Creating the Master Set Layout: <fo:layout-master-set>
Creating a Page Master: <fo:simple-page-master>
Creating Regions
Creating Page Sequences: <fo:page-sequence>
Creating Flows: <fo:flows>
Creating Block-Level Content: <fo:block>
Creating Tables
Creating Tables: <fo:table>
Creating Table Columns: <fo:table-column>
Creating Table Bodies: <fo:table-body>
Creating Table Rows: <fo:table-row>
Creating Table Cells: <fo:table- cell >
12. Using XSLT to Create XSL-FO Documents: Lists, Images, Columns, and Positioning
Creating XSL-FO Lists
Positioning Text with Block Containers: <fo:block-container>
Inline-Level Formatting Objects
Creating Footnotes: <fo:footnote> and <fo:footnote-body>
Creating Links: <fo: basic-link >
Creating Columns
Page Sequences and Page Numbering
A. The XSLT DTD
DTD Fragment for XSLT Stylesheets (Non-Normative)
B. XSL-FO Formatting Properties