Changeset 4 in recipecards for trunk/recipe.html.xsl
- Timestamp:
- 09/11/13 19:49:05 (11 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/recipe.html.xsl
r2 r4 2 2 3 3 <xsl:stylesheet version="1.0" 4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 5 xmlns:fo="http://www.w3.org/1999/XSL/Format"> 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"> 6 7 7 <!-- TODO: come up with various page configurations, 8 e.g. index card, half letter, full letter hole-punched, etc. 9 --> 10 <xsl:param name="size">5x8</xsl:param> 11 <xsl:variable name="height" select="substring-before($size, 'x')"/> 12 <xsl:variable name="width" select="substring-after($size, 'x')"/> 13 14 <xsl:template match="recipe"> 15 <fo:root font-family="DejaVuSerif" font-size="10pt"> 16 <fo:layout-master-set> 17 <fo:simple-page-master master-name="recipe-card" page-height="{$height}in" page-width="{$width}in"> 18 <fo:region-body margin=".25in .5in .25in .25in"/> 19 </fo:simple-page-master> 20 </fo:layout-master-set> 21 22 <fo:page-sequence master-reference="recipe-card"> 23 <fo:flow flow-name="xsl-region-body"> 24 <xsl:apply-templates/> 25 </fo:flow> 26 </fo:page-sequence> 27 </fo:root> 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> 28 17 </xsl:template> 29 18 30 <xsl:template match="title"> 31 <fo:block margin-bottom=".5em" font-weight="bold"> 32 <xsl:value-of select="."/> 33 </fo:block> 19 <xsl:template match="recipe:title" mode="head"> 20 <title><xsl:value-of select="."/></title> 34 21 </xsl:template> 35 22 36 <xsl:template match="ingredients"> 37 <fo:block margin-bottom=".5em"> 38 <xsl:apply-templates/> 39 </fo:block> 23 <xsl:template match="recipe:title"> 24 <h1 class="fn"><xsl:value-of select="."/></h1> 40 25 </xsl:template> 41 26 42 <xsl:template match="ingredient"> 43 <fo:block line-height="1.25"><xsl:value-of select="."/></fo:block> 27 <xsl:template match="recipe:ingredients"> 28 <ul> 29 <xsl:apply-templates/> 30 </ul> 44 31 </xsl:template> 45 32 46 <xsl:template match=" note">47 < fo:block line-height="1.25" margin-left="1em" font-size="90%"><xsl:value-of select="."/></fo:block>33 <xsl:template match="recipe:ingredient"> 34 <li class="ingredient"><xsl:value-of select="."/></li> 48 35 </xsl:template> 49 36 50 <xsl:template match="para"> 51 <fo:block margin-bottom=".5em"> 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> 52 43 <xsl:value-of select="."/> 53 </ fo:block>44 </p> 54 45 </xsl:template> 55 46
Note: See TracChangeset
for help on using the changeset viewer.