After years of anticipation and delay, the W3C finally released the XSLT 2.0 standard in January 2007. The revised edition of this classic book offers practical, real-world examples that demonstrate how you can apply XSLT stylesheets to XML data using either the new specification, or the older XSLT 1.0 standard.

XSLT is a critical language for converting XML documents into other formats, such as HTML code or a PDF file. With XSLT, you get a ...

See more details below

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • 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%)$39.99 List Price


After years of anticipation and delay, the W3C finally released the XSLT 2.0 standard in January 2007. The revised edition of this classic book offers practical, real-world examples that demonstrate how you can apply XSLT stylesheets to XML data using either the new specification, or the older XSLT 1.0 standard.

XSLT is a critical language for converting XML documents into other formats, such as HTML code or a PDF file. With XSLT, you get a thorough understanding of XSLT and XPath and their relationship to other web standards, along with recommendations for a honed toolkit in an open platform-neutral, standards-based environment. This book:

  • Covers the XSLT basics, including simple stylesheets and methods for setting up transformation engines
  • Walks you through the many parts of XSLT, particularly XSLT's template-based approach to transformations
  • Applies both XSLT 1.0 and 2.0 solutions to the same problems, helping you decide which version of XSLT is more appropriate for your project
  • Includes profuse examples that complement both the tutorial and the reference material

The new edition of XSLT has been updated thoroughly to explain XSLT 2.0's many dependencies, notably XML Schema and XPath 2.0. Want to find out how the 2.0 specification improves on the old? This book will explain.

Read More Show Less

Product Details

  • ISBN-13: 9781449391126
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 6/26/2008
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 990
  • Sales rank: 884,350
  • File size: 7 MB

Meet the Author

Doug Tidwell is a senior programmer at IBM. He has more than a sixth of a century of programming experience, and has been working with markup languages for more than a decade. He was a speaker at the first XML conference in 1997, and has taught XML classes around the world. His job as a Cyber Evangelist is to look busy and to help people use new technologies to solve problems. Using a pair of zircon-encrusted tweezers, he holds a master's degree in computer science from Vanderbilt University and a bachelor's degree in English from the University of Georgia. He lives in Raleigh, North Carolina, with his wife, cooking teacher Sheri Castle (see her web site at http://www.sheri-inc.com) and their daughter Lily.
Read More Show Less

Read an Excerpt

Chapter 5: Creating Links and Cross-References


Generating Links with the id() Function
Generating Links with the key() Function
Generating Links in Unstructured Documents

If you're creating a web site, publishing a book, or creating an XML transaction, chances are many pieces of information will refer to other things. This chapter discusses a several ways to link XML elements. It reviews three techniques:

  • Using the id() function

  • Doing more advanced linking with the key() function

  • Generating links in unstructured documents

Generating Links with the id() Function

Our first attempt at linking will be with the XPath id() function.

The ID, IDREF, and IDREFs Datatypes

Three of the basic datatypes supported by XML Document Type Definitions (DTDs) are ID, IDREF, and IDREFS. Here's a simple DTD that illustrates these datatypes:

<!--The containing tag for the entire glossary-->
<!ELEMENT glossary  (glentry+) >

<!--A glossary entry-->
<!ELEMENT glentry  (term,defn+) >

<!--The word being defined-->
<!ELEMENT term  (#PCDATA) >
<!--The id is used for cross-referencing, and the 
    xreftext is the text used by cross-references.-->
<!ATTLIST term
               id  ID    #REQUIRED 
               xreftext  CDATA    #IMPLIED  >

<!--The definition of the term-->
<!ELEMENT defn  (#PCDATA | xref | seealso)* >

<!--A cross-reference to another term-->
<!ELEMENT xref   EMPTY  >

<!--refid is the ID of the referenced term-->
<!ATTLIST xref
               refid  IDREF    #REQUIRED >

<!--seealso refers to one or more other definitions-->
<!ELEMENT seealso EMPTY>
<!ATTLIST seealso
                  refids   IDREFS  #REQUIRED >

In this DTD, each <term> element is required to have an id attribute, and each <xref> element must have an refid attribute. The ID and IDREF datatypes work according to two rules:

  • Each value of the id attribute must be unique.

  • Each value of the refid attribute must match a value of an id attribute elsewhere in the document.

To round out our example, the <seealso> element contains an attribute of type IDREFS. This datatype contains one or more values, each of which must match a value of an ID elsewhere in the document. Multiple values, if present, are separated by whitespace.

There are some complications of ID and related datatypes, but we'll discuss them later. For now, we'll focus on how the id() function works.

An XML Document in Need of Links

To illustrate the value of linking, we'll use a small glossary written in XML. The glossary contains some <glentry> elements, each of which contains a single <term> and one or more <defn> elements. In addition, a definition is allowed to contain a cross-reference (<xref>) to another <term>. Here's a short sample document:

<?xml version="1.0" ?>
<!DOCTYPE glossary SYSTEM "glossary.dtd">
    <term id="applet">applet</term>
      An application program,
      written in the Java programming language, that can be 
      retrieved from a web server and executed by a web browser. 
      A reference to an applet appears in the markup for a web 
      page, in the same way that a reference to a graphics
      file appears; a browser retrieves an applet in the same 
      way that it retrieves a graphics file. 
      For security reasons, an applet's access rights are limited
      in two ways: the applet cannot access the file system of the 
      client upon which it is executing, and the applet's 
      communication across the network is limited to the server 
      from which it was downloaded. 
      Contrast with <xref refid="servlet"/>.
      <seealso refids="wildcard-char DMZlong pattern-matching"/>

    <term id="DMZlong" xreftext="demilitarized zone">demilitarized 
      zone (DMZ)</term>
      In network security, a network that is isolated from, and 
      serves as a neutral zone between, a trusted network (for example, 
      a private intranet) and an untrusted network (for example, the
      Internet). One or more secure gateways usually control access 
      to the DMZ from the trusted or the untrusted network.

    <term id="DMZ">DMZ</term>
      See <xref refid="DMZlong"/>.

    <term id="pattern-matching">pattern-matching character</term>
      A special character such as an asterisk (*) or a question mark 
      (?) that can be used to represent zero or more characters. 
      Any character or set of characters can replace a pattern-matching 

    <term id="servlet">servlet</term>
      An application program, written in the Java programming language, 
      that is executed on a web server. A reference to a servlet 
      appears in the markup for a web page, in the same way that a 
      reference to a graphics file appears. The web server executes
      the servlet and sends the results of the execution (if there are
      any) to the web browser. Contrast with <xref refid="applet" />.

    <term id="wildcard-char">wildcard character</term>
      See <xref refid="pattern-matching"/>.

In this XML listing, each <term> element has an id attribute that identifies it uniquely. Many <xref> elements also refer to other terms in the listing. Notice that each time we refer to another term, we don't use the actual text of the referenced term. When we write our stylesheet, we'll use the XPath id function to retrieve the text of the referenced term; if the name of a term changes (as buzzwords go in and out of fashion, some marketing genius might want to rename the "pattern-matching character," for example), we can rerun our stylesheet and be confident that all references to the new term contain the correct text.

Finally, some <term> elements have an xreftext element because some of the actual terms are longer than we'd like to use in a cross-reference. When we have an <xref> to the term ASCII (American Standard Code for Information Interchange), it would get pretty tedious if the entire text of the term appeared throughout our document. For this term, we'll use the xreftext attribute's value, ensuring that the cross-reference contains the less-intimidating text ASCII....

Read More Show Less

Table of Contents

1 Getting Started 1
2 The Obligatory Hello World Example 21
3 XPath: A Syntax for Describing Needles and Haystacks 42
4 Branching and Control Elements 65
5 Creating Links and Cross-References 99
6 Sorting and Grouping Elements 129
7 Combining XML Documents 148
8 Extending XSLT 166
9 Case Study: The Toot-O-Matic 212
A XSLT Reference 237
B XPath Reference 332
C XSLT and XPath Function Reference 341
D XSLT Guide 434
Glossary 443
Index 451
Read More Show Less

Customer Reviews

Average Rating 3
( 5 )
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 5 Customer Reviews
  • Anonymous

    Posted September 19, 2001

    O'Reilly delivers again

    Although Tidwell emphasizes a real-world approach to tackling XSLT and includes plenty of practical examples in the book, he doesn't skimp when it comes to delivering the types of conceptual explanations (sections like 'How a Stylesheet is processed' in Chpt 2 and 'The XPath View of an XML Document' in Chpt. 3) that help readers understand what's going on 'under the hood'. Including a separate chapter covering the basics of XPath early in the book also makes for much easier reading, since we aren't left scrounging for scraps of information scattered throughout the text when XPath-related questions arise. If not for the fact that some authors have actually taken the opposite approach (introducing XPath concepts as they arise in the context of a discussion of XSLT), this would have seemed like a no-brainer. No review of this book would be complete without mentioning the value added by the appendices. Once you've digested all of the material in the body of the text, you'll likely continue to keep Tidwell's book close at hand because of Appendices A and C. Appendix A, the XSLT Reference, features a comprehensive dictionary-style reference for every element in XSLT 1.0 - including an XML source document, an example stylesheet that makes use of the element, and the result of the transformation for each. Appendix C, the XSLT and XPath Function Reference, follows a similar format.

    1 out of 1 people found this review helpful.

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

    Posted August 11, 2010

    No text was provided for this review.

  • Anonymous

    Posted February 6, 2010

    No text was provided for this review.

  • Anonymous

    Posted December 18, 2009

    No text was provided for this review.

  • Anonymous

    Posted April 5, 2010

    No text was provided for this review.

Sort by: Showing all of 5 Customer Reviews

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