Skip to content

Instantly share code, notes, and snippets.

@ethangardner
Created June 28, 2011 23:49
Show Gist options
  • Save ethangardner/1052528 to your computer and use it in GitHub Desktop.
Save ethangardner/1052528 to your computer and use it in GitHub Desktop.
XSL Restaurant Menu 2
<xsl:template match="/">
<!-- creates a template and the match="/" applies
it to the root (document element). This also sets the
context of the other match statements in the XSL.
If the conditions of the match statement are true,
some other code will be processed and output.
-->
<html>
<head>
<link rel="stylesheet" href="restaurant-menu.css" />
<!-- loading an external stylesheet for demonstration -->
</head>
<body>
<div id="containerMain">
<!-- Here, we are setting up some HTML tags for formatting.
You may be wondering why there is no DOCTYPE declared.
We are ultimately going to embed the transformed content
into a PHP file in a later tutorial which will contain our
DOCTYPE, so we will omit it here.
-->
<xsl:apply-templates />
<!-- apply-templates on the line above is a self closing tag
that calls all the templates in the document. One
of the most powerful features of XSL is that templates are
able to call other templates. The concept of a template
is similar to a function in many programming languages.
-->
</div>
</body>
</html>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment