Pattern Matching with match= and select=
We've seen some basic XSL as well as several tools for processing and using XSL. What we need now is a more in-depth understanding of how the match= and select= attributes to xsl:template and xsl:apply-templates elements function.
Let's start from the top and examine the whole pattern matching process more closely. Each document contains a root element. The root element is selected via the match="/" attribute to xsl:template. The select= attribute of the xsl:value-of element works almost identically. Both match= and select= work on patterns. Examples of patterns might be
match="/"—Match the root element.
select="Listing"—Select any Listing element child.
match="*"—Match any element.
match="Town|County"—
Get XML Development with Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.