Cover image for Learning XSLT
Title:
Learning XSLT
Author:
Fitzgerald, Michael, 1957-
Personal Author:
Edition:
First edition.
Publication Information:
Sebastopol, CA ; Farnham : O'Reilly, [2004]

©2004
Physical Description:
xiii, 352 pages : illustrations ; 24 cm
General Note:
"A hands-on introduction to XSLT and XPath"--Cover.

Includes index.
Language:
English
ISBN:
9780596003272
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Central Library QA76.73.X58 F58 2004 Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

XSLT is a powerful language for transforming XML documents into something else. That something else can be an HTML document, another XML document, a Portable Document Format (PDF) file, a Scalable Vector Graphics (SVG) file, a Virtual Reality Modeling Language (VRML) file, Java code, or a number of other things. You write an XSLT stylesheet to define the rules for transforming an XML document, and the XSLT processor does the work.As useful as XSLT is, its peculiar characteristics make it a difficult language in which to get started. In fact, newcomers are often a little dazed on first contact. Learning XSLT offers a hands-on introduction to help them get up to speed with XSLT quickly. The book will help web developers and designers understand this powerful but often mystifying template-driven and functional-styled language, getting them over the many differences between XSLT and the more conventional programming languages. Learning XSLT moves smoothly from the simple to complex, illustrating all aspects of XSLT 1.0 through step-by-step examples that you'll practice as you work through the book. Thorough in its coverage of the language, the book makes few assumptions about what you may already know. You'll learn about XSLT's template-based syntax, how XSLT templates work with each other, and gain an understanding of XSLT variables. Learning XSLT also explains how the XML Path Language (XPath) is used by XSLT and provides a glimpse of what the future holds for XSLT 2.0 and XPath 2.0.The ability to transform one XML vocabulary to another is fundamental to exploiting the power of XML. Learning XSLT is a carefully paced, example-rich introduction to XSLT that will have you understanding and using XSLT on your own in no time.


Author Notes

Michael Fitzgerald is a freelance writer and trainer specializing in XML and related technologies. He is the author of Building B2B Applications with XML and XSL Essentials, both published by John Wiley & Sons, and has published several articles for XML.com on the O'Reilly Network.


Table of Contents

Prefacep. ix
1. Transforming Documents with XSLTp. 1
How XSLT Worksp. 2
Using Client-Side XSLT in a Browserp. 6
Using apply-templatesp. 9
2. Building New Documents with XSLTp. 16
Outputting Textp. 16
Literal Result Elementsp. 23
Using the Element Called elementp. 31
Adding Attributesp. 33
Outputting Commentsp. 37
Outputting Processing Instructionsp. 38
One Final Examplep. 42
3. Controlling Outputp. 45
The Output Methodp. 46
Outputting XMLp. 48
Outputting HTMLp. 64
Outputting Textp. 70
Using a QName Output Methodp. 74
Media Typesp. 75
4. Traversing the Treep. 77
The XPath Data Modelp. 77
Location Pathsp. 82
Expressionsp. 83
What Is a Pattern?p. 84
Predicatesp. 85
Axesp. 92
Name and Node Testsp. 96
Doing the Math with Expressionsp. 99
5. XPath and XSLT Functionsp. 102
Boolean Functionsp. 104
Node-Set Functionsp. 106
Number Functionsp. 107
String Functionsp. 108
6. Copying Nodesp. 113
The copy Elementp. 113
The copy-of Elementp. 118
Copying Nodes from Two Documentsp. 120
7. Using Variables and Parametersp. 123
Defining Variables and Parametersp. 124
Using Variablesp. 127
Using Parametersp. 130
Invoking Templates with Parametersp. 132
Using Result Tree Fragmentsp. 133
8. Sorting Things Outp. 137
Simple Ascending Sortp. 137
Reversing the Sortp. 142
By the Numbersp. 145
Multiple Sortsp. 148
The lang and case-order Attributesp. 152
9. Numbering Listsp. 153
Numbered Listsp. 153
Alphabetical Listsp. 158
Roman Numeralsp. 162
Inserting an Individual Formatted Valuep. 163
Numbering Levelsp. 165
The from Attributep. 174
The lang and letter-value Attributesp. 175
More Help with Formatted Numbersp. 175
10. Templatesp. 180
Template Priorityp. 181
Calling a Named Templatep. 186
Using Templates with Parametersp. 190
Modesp. 192
Built-in Template Rulesp. 194
11. Using Keysp. 199
A Simple Keyp. 199
More Than One Keyp. 202
Using a Parameter with Keysp. 203
Cross-Referencing with Keysp. 204
Grouping with Keysp. 206
12. Conditional Processingp. 211
The if Elementp. 212
The choose and when Elementsp. 217
13. Working with Multiple Documentsp. 225
Including Stylesheetsp. 225
Importing Stylesheetsp. 230
Using the document() Functionp. 235
14. Alternative Stylesheetsp. 241
A Literal Result Element Stylesheetp. 241
An Embedded Stylesheetp. 244
Aliasing a Namespacep. 247
Excluding Namespacesp. 251
15. Extensionsp. 254
Xalan, Saxon, and EXSLT Extensionsp. 255
Using a Saxon Extension Attributep. 257
Result Tree Fragment to Node-Setp. 260
Using EXSLTp. 262
Fallback Behaviorp. 265
Checking for Extension Availabilityp. 269
16. XSLT 2.0 and XPath 2.0p. 271
New XSLT 2.0 Featuresp. 272
New XPath 2.0 Featuresp. 275
Multiple Result Treesp. 277
Using Regular Expressionsp. 281
Grouping in XSLT 2.0p. 286
Extension Functionsp. 288
17. Writing an XSLT Processor Interfacep. 291
Running an XSLT Processor from Javap. 291
Writing an XSLT Processor with C#p. 300
18. Parting Wordsp. 306
The Ox Documentation Toolp. 307
Signing Offp. 310
Appendix XSLT Processorsp. 311
Glossaryp. 331
Indexp. 343

Google Preview