| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | |
|---|
| 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"> |
|---|
| 6 | |
|---|
| 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> |
|---|
| 28 | </xsl:template> |
|---|
| 29 | |
|---|
| 30 | <xsl:template match="title"> |
|---|
| 31 | <fo:block margin-bottom=".5em" font-weight="bold"> |
|---|
| 32 | <xsl:value-of select="."/> |
|---|
| 33 | </fo:block> |
|---|
| 34 | </xsl:template> |
|---|
| 35 | |
|---|
| 36 | <xsl:template match="ingredients"> |
|---|
| 37 | <fo:block margin-bottom=".5em"> |
|---|
| 38 | <xsl:apply-templates/> |
|---|
| 39 | </fo:block> |
|---|
| 40 | </xsl:template> |
|---|
| 41 | |
|---|
| 42 | <xsl:template match="ingredient"> |
|---|
| 43 | <fo:block line-height="1.25"><xsl:value-of select="."/></fo:block> |
|---|
| 44 | </xsl:template> |
|---|
| 45 | |
|---|
| 46 | <xsl:template match="note"> |
|---|
| 47 | <fo:block line-height="1.25" margin-left="1em" font-size="90%"><xsl:value-of select="."/></fo:block> |
|---|
| 48 | </xsl:template> |
|---|
| 49 | |
|---|
| 50 | <xsl:template match="para"> |
|---|
| 51 | <fo:block margin-bottom=".5em"> |
|---|
| 52 | <xsl:value-of select="."/> |
|---|
| 53 | </fo:block> |
|---|
| 54 | </xsl:template> |
|---|
| 55 | |
|---|
| 56 | </xsl:stylesheet> |
|---|