XSLT Cookbook

( 2 )


Forget those funky robot toys that were all the rage in the '80s, XSLT (Extensible Stylesheet Transformations) is the ultimate transformer. This powerful language is expert at transforming XML documents into PDF files, HTML documents, JPEG files—virtually anything your heart desires. As useful as XSLT is, though, most people have a difficult time learning its many peculiarities. And now Version 2.0, while elegant and powerful, has only added to the confusion.

XSLT Cookbook, ...

See more details below
Paperback (Second Edition)
BN.com price
(Save 28%)$54.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (19) from $6.39   
  • New (9) from $31.17   
  • Used (10) from $6.39   
XSLT Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 42%)$43.99 List Price


Forget those funky robot toys that were all the rage in the '80s, XSLT (Extensible Stylesheet Transformations) is the ultimate transformer. This powerful language is expert at transforming XML documents into PDF files, HTML documents, JPEG files—virtually anything your heart desires. As useful as XSLT is, though, most people have a difficult time learning its many peculiarities. And now Version 2.0, while elegant and powerful, has only added to the confusion.

XSLT Cookbook, Second Edition wants to set the record straight. It helps you sharpen your programming skills and overall understanding of XSLT through a collection of detailed recipes. Each recipe breaks down a specific problem into manageable chunks, giving you an easy-to-grasp roadmap for integrating XSLT with your data and applications. No other XSLT book around employs this practical problem-solution-discussion format.

In addition to offering code recipes for solving everyday problems with XSLT 1.0, this new edition shows you how to leverage the improvements found in XSLT 2.0, such as how to simplify the string manipulation and date/time conversion processes. The book also covers XPath 2.0, a critical companion standard, as well as topics ranging from basic transformations to complex sorting and linking. It even explores extension functions on a variety of different XSLT processors and shows ways to combine multiple documents using XSLT. Code examples add a real-world dimension to each technique.

Whether you're just starting out in XSLT or looking for advanced techniques, you'll find the level of information you need in XSLT Cookbook, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780596009748
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/13/2005
  • Series: Cookbooks (O'Reilly) Series
  • Edition description: Second Edition
  • Edition number: 2
  • Pages: 778
  • Sales rank: 1,507,399
  • Product dimensions: 7.00 (w) x 9.19 (h) x 1.43 (d)

Meet the Author

Sal Mangano has worked as a developer on Wall Street for 12 years, including work at the New York Stock Exchange and Morgan Stanley. He has a Master's degree in Computer Science from Polytechnic University and is currently working as an independent consultant, focused on financial applications of XML and related technologies.

Read More Show Less

Table of Contents

Structure of This Book;
Conventions Used in This Book;
Using Code Examples;
Safari Enabled;
How to Contact Us;
Chapter 1: XPath;
1.1 Introduction;
1.1 Effectively Using Axes;
1.2 Filtering Nodes;
1.3 Working with Sequences;
1.4 Shrinking Conditional Code with If Expressions;
1.5 Eliminating Recursion with for Expressions;
1.6 Taming Complex Logic Using Quantifiers;
1.7 Using Set Operations;
1.8 Using Node Comparisons;
1.9 Coping with XPath 2.0's Extended Type System;
1.10 Exploiting XPath 2.0's Extended Type System;
Chapter 2: Strings;
2.1 Introduction;
2.1 Testing If a String Ends with Another String;
2.2 Finding the Position of a Substring;
2.3 Removing Specific Characters from a String;
2.4 Finding Substrings from the End of a String;
2.5 Duplicating a String N Times;
2.6 Reversing a String;
2.7 Replacing Text;
2.8 Converting Case;
2.9 Tokenizing a String;
2.10 Making Do Without Regular Expressions;
2.11 Exploiting Regular Expressions;
2.12 Using the EXSLT String Extensions;
Chapter 3: Numbers and Math;
3.1 Introduction;
3.1 Formatting Numbers;
3.2 Rounding Numbers to a Specified Precision;
3.3 Converting from Roman Numerals to Numbers;
3.4 Converting from One Base to Another;
3.5 Implementing Common Math Functions;
3.6 Computing Sums and Products;
3.7 Finding Minimums and Maximums;
3.8 Computing Statistical Functions;
3.9 Computing Combinatorial Functions;
3.10 Testing Bits;
Chapter 4: Dates and Times;
4.1 Introduction;
4.1 Calculating the Day of the Week;
4.2 Determining the Last Day of the Month;
4.3 Getting Names for Days and Months;
4.4 Calculating Julian and Absolute Day Numbers from a Specified Date;
4.5 Calculating the Week Number for aSpecified Date;
4.6 Working with the Julian Calendar;
4.7 Working with the ISO Calendar;
4.8 Working with the Islamic Calendar;
4.9 Working with the Hebrew Calendar;
4.10 Formatting Dates and Times;
4.11 Determining Secular and Religious Holidays;
Chapter 5: Selecting and Traversing;
5.1 Introduction;
5.1 Ignoring Duplicate Elements;
5.2 Selecting All but a Specific Element;
5.3 Selecting Nodes by Context;
5.4 Performing a Preorder Traversal;
5.5 Performing a Postorder Traversal;
5.6 Performing an In-Order Traversal;
5.7 Performing a Level-Order Traversal;
5.8 Processing Nodes by Position;
Chapter 6: Exploiting XSLT 2.0;
6.1 Introduction;
6.1 Convert Simple Named Templates to XSLT Functions;
6.2 Prefer for-each-group over Muenchian Method of Grouping;
6.3 Modularizing and Modes;
6.4 Using Types for Safety and Precision;
6.5 Avoiding 1.0 to 2.0 Porting Pitfalls;
6.6 Emulating Object-Oriented Reuse and Design Patterns;
6.7 Processing Unstructured Text with Regular Expressions;
6.8 Solving Difficult Serialization Problems with Character Maps;
6.9 Outputting Multiple Documents;
6.10 Handling String Literals Containing Quote Characters;
6.11 Understanding the New Capabilities of Old XSLT 1.0 Features;
Chapter 7: XML to Text;
7.1 Introduction;
7.1 Dealing with Whitespace;
7.2 Exporting XML to Delimited Data;
7.3 Creating a Columnar Report;
7.4 Displaying a Hierarchy;
7.5 Numbering Textual Output;
7.6 Wrapping Text to a Specified Width and Alignment;
Chapter 8: XML to XML;
8.1 Introduction;
8.1 Converting Attributes to Elements;
8.2 Converting Elements to Attributes;
8.3 Renaming Elements or Attributes;
8.4 Merging Documents with Identical Schema;
8.5 Merging Documents with Unlike Schema;
8.6 Splitting Documents;
8.7 Flattening an XML Hierarchy;
8.8 Deepening an XML Hierarchy;
8.9 Reorganizing an XML Hierarchy;
Chapter 9: Querying XML;
9.1 Introduction;
9.1 Performing Set Operations on Node Sets;
9.2 Performing Set Operations on Node Sets Using Value Semantics;
9.3 Determining Set Equality by Value;
9.4 Performing Structure-Preserving Queries;
9.5 Joins;
9.6 Implementing the W3C XML Query-UseCases in XSLT;
Chapter 10: XML to HTML;
10.1 Introduction;
10.1 Using XSLT as a Styling Language;
10.2 Creating Hyperlinked Documents;
10.3 Creating HTML Tables;
10.4 Creating Frames;
10.5 Creating Data-Driven Stylesheets;
10.6 Creating a Self-Contained HTML Transformation;
10.7 Populating a Form;
Chapter 11: XML to SVG;
11.1 Introduction;
11.1 Transforming an Existing Boilerplate SVG;
11.2 Creating Reusable SVG Generation Utilities for Graphs and Charts;
11.3 Creating a Tree Diagram;
11.4 Creating Interactive SVG-Enabled Web Pages;
Chapter 12: Code Generation;
12.1 Introduction;
12.1 Generating Constant Definitions;
12.2 Generating Switching Code;
12.3 Generating Message-Handling Stub Code;
12.4 Generating Data Wrappers;
12.5 Generating Pretty Printers;
12.6 Generating a Test Data-Entry Web Client;
12.7 Generating Test-Entry Web CGI;
12.8 Generating Code from UML Models via XMI;
12.9 Generating XSLT from XSLT;
Chapter 13: Vertical XSLT Application Recipes;
13.1 Introduction;
13.1 Converting Visio VDX Documents to SVG;
13.2 Working with Excel XML Spreadsheets;
13.3 Generating XTM Topic Maps from UML Modelsvia XMI;
13.4 Generating Web Sites from XTM Topic Maps;
13.5 Serving SOAP Documentation from WSDL;
Chapter 14: Extending and Embedding XSLT;
14.1 Introduction;
14.1 Saxon Extension Functions;
14.2 Saxon Extension Elements;
14.3 Xalan-Java 2 Extension Functions;
14.4 Java Extension Function Using the Class Format Namespace;
14.5 Java Extension Function Using the Package Format Namespace;
14.6 Java Extension Function Using the Java Format Namespace;
14.7 Scripting Extension Function Using Inline Script Code;
14.8 Xalan-Java 2 Extension Elements;
14.9 Java Extension Element;
14.10 Scripting Extension Elements;
14.11 MSXML Extension Functions;
14.12 Using Saxon's and Xalan's Native Extensions;
14.13 Extending XSLT with JavaScript;
14.14 Adding Extension Functions Using Java;
14.15 Adding Extension Elements Using Java;
14.16 Using XSLT from Perl;
14.17 Using XSLT from Java;
Chapter 15: Testing and Debugging;
15.1 Introduction;
15.1 Using xsl:message Effectively;
15.2 Tracing the Flow of Your Stylesheet Through Its Input Document;
15.3 Automating the Insertion of Debug Output;
15.4 Including Embedded Unit Test Data in Utility Stylesheets;
15.5 Structuring Unit Tests;
15.6 Testing Boundary and Error Conditions;
Chapter 16: Generic and Functional Programming;
16.1 Introduction;
16.1 Creating Polymorphic XSLT;
16.2 Creating Generic Element Aggregation Functions;
16.3 Creating Generic Bounded Aggregation Functions;
16.4 Creating Generic Mapping Functions;
16.5 Creating Generic Node-Set Generators;

Read More Show Less

Customer Reviews

Average Rating 5
( 2 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted October 7, 2006


    Are you a developer? If you are, then this book is for you. Author Sal Mangano, has done an outstanding job of writing a 2nd edition of a book that offers hundreds of solutions to problems that developers regularly face in both versions 1.0 and 2.0. Mangano, begins by briefly explaining the greater sophistication and complexity of Xpath 2.0. Then, the author shows you that almost anything one wants to do with strings can be done within the confines of XSLT as well as, how the new features of 2.0 make it that much easier. The author then shows you how to push the limits of XSLT¿s mathematical capabilities, even though XSLT was not designed to be the next great Fortran replacement. Next, he describes date and time recipes that augment an area standard that XSLT 1.0 currently lacks. The author continues by exploring the problems XSLT was specifically designed to solve. Then, the author presents an overview of XSLT 2.0. Next, he provides recipes that control how text extracted from XML is rendered for layout on the terminal, on the text editor, or for import to programs that require delimited data, such as comma separated values. The author then covers XML transformations. Then, he presents a treasure trove of recipes that demonstrate XSLT as a query language. The author continues by demonstrating solutions to problems that arise when generating web content, including links, tables, frames, forms, and other client-side transformation issues. Then, he describes the transformation of raw data into bar charts, pie charts, line plots, and other graphical components. Next, the author shows you the advantage gained from representing the data that drives code generation in XML and illustrates how XSLT is ideal for writing code generators for C++, Java, and XSLT itself. He also includes some advance uses of XSLT. The author continues by providing extensive coverage of XSLT extensibility using Java and JavaScript. Then, he demonstrates useful techniques that can help you transform misbehaved XSLT programs into functional ones, even if you don¿t have a nature XSLT debugger handy. Finally, he pushes the XSLT envelope to show how XSLT is far more than just another styling language. This most excellent book has recipes that range from simple string manipulation and mathematical processing to more complex topics such as extending XSLT, testing and debugging XSLT stylesheets, and creating graphics with SVG. More importantly, the recipes in this book will guide you through many different ways of applying XSLT.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 7, 2004

    Wow! What a great XSLT book!

    The O¿Reilly Cookbook series is a great place to find answers to really hard problems. I like the series because I can go to the ¿cookbook¿ subject I¿m having trouble with, leaf through a few pages, and see an answer to a problem that is similar to my own. The XSLT Cookbook is very similar in structure to the other ¿cookbooks¿, but with an XSLT flavor. After going through the various recipes in this book, I can honestly say that I am amazed at the kind of things you can do with just XSLT. You can do more than just reformat XML to look nice on an HTML page¿you can even use it to calculate statistical functions! Even if you¿re not planning on calculating a combinatoric, just looking through some of these patterns will make you a better XSLT programmer. One nice thing this book provides beyond the recipes is a discussion on how to extend XSLT via SAXON or Java. There is also discussion on how to use XSLT via Perl or Java. I was very impressed by the amount of time and thought that was put into the creation of many of these recipes¿not only are many of them really, really hard to do, but they¿re also things I¿ve seen a real need for in the real world. XSLT programmers, do yourself a favor and take a look through this book before you hurt your brain with your next assignment.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 13, 2004

    A must have for XSLT developers

    Buy it. Read it. Use it. Prosper. If your doing XSLT it is simply that good.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 16, 2008

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)