Skip to Content
Learning XSLT
book

Learning XSLT

by Michael Fitzgerald
November 2003
Beginner
368 pages
9h 33m
English
O'Reilly Media, Inc.
Content preview from Learning XSLT

Chapter 10. Templates

You’ve learned a lot about template rules—how to create them, how to write patterns that trigger them, and how to generate results from them. You should be familiar with the following concepts about templates:

  • Template rules attempt to match patterns in a source document. A pattern is a subset of an expression, which is mostly used to match child elements and attributes using the child and attribute axes. (You can also use predicates, plus the id( ) and key( ) functions. You learned about predicates in Chapter 4 and about id( ) in Chapter 5, and you will learn about key( ) in the next chapter.)

  • When a pattern is matched in a source document, the content of the template (called a sequence constructor in XSLT 2.0) is instantiated or written out to the result tree.

  • When apply-templates is used in a template element, it processes the children of the matched pattern, searching for other template rules that match those children.

  • If the select attribute is used on apply-templates, it processes the children of the matched pattern that are specifically named in the attribute, searching for template rules that match those nodes so named. The select attribute can contain an expression.

  • Built-in templates do behind-the-scenes work in processing nodes that may not be explicitly identified in templates rules, such as text nodes.

This chapter discusses additional issues related to templates, namely, what template priority is, how to create and call named templates, how to use ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XSLT

XSLT

Doug Tidwell
Java and XSLT

Java and XSLT

Eric M. Burke
Inside XSLT

Inside XSLT

Steven Holzner
XSLT and XPATH: A Guide to XML Transformations

XSLT and XPATH: A Guide to XML Transformations

John Robert Gardner, Zarella L. Rendon

Publisher Resources

ISBN: 0596003277Supplemental ContentErrata Page