Templates
Absolutely everything in XSLT is based on one element: the template. Templates are used to decide what elements should be output, and how. Although most applications have built-in templates, which makes it difficult to learn the basics, the Working Draft version of IE5 does not, which makes it easier for us to get a feel for what's happening. For the benefit of those using the older namespace, and because it won't hurt anything, we'll duplicate those built-in templates.
The most basic template is shown in Listing 2.7.
Listing 2.7. catalog.xsl: The Basic Template
0:<?xml version="1.0"?> 1:<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 2: 3:<xsl:template match="/"> 4: <xsl:value-of select="."/> 5:</xsl:template> ... |
Get XML and Java™ from scratch 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.