source: recipecards/trunk/recipe.html.xsl

Last change on this file was 4, checked in by peter, 11 years ago
  • put the recipe XML into a namespace (http://xmlns.grim.ath.cx/recipe)
  • match "degrees" and turn it into a degree symbol
  • added a recipe.html.xsl stylesheet that transforms recipe XML into HTML marked up with the hRecipe microformat
File size: 1.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<xsl:stylesheet version="1.0"
4  xmlns="http://www.w3.org/1999/xhtml"
5  xmlns:recipe="http://xmlns.grim.ath.cx/recipe"
6  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7
8  <xsl:template match="recipe:recipe">
9    <html>
10      <head>
11        <xsl:apply-templates select="title" mode="head"/>
12      </head>
13      <body class="hRecipe">
14        <xsl:apply-templates/>
15      </body>
16    </html>
17  </xsl:template>
18
19  <xsl:template match="recipe:title" mode="head">
20    <title><xsl:value-of select="."/></title>
21  </xsl:template>
22
23  <xsl:template match="recipe:title">
24    <h1 class="fn"><xsl:value-of select="."/></h1>
25  </xsl:template>
26
27  <xsl:template match="recipe:ingredients">
28    <ul>
29      <xsl:apply-templates/>
30    </ul>
31  </xsl:template>
32
33  <xsl:template match="recipe:ingredient">
34    <li class="ingredient"><xsl:value-of select="."/></li>
35  </xsl:template>
36
37  <xsl:template match="recipe:note">
38    <div style="margin-left:1em; font-size: 90%"><xsl:value-of select="."/></div>
39  </xsl:template>
40
41  <xsl:template match="recipe:para">
42    <p>
43      <xsl:value-of select="."/>
44    </p>
45  </xsl:template>
46
47</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.