~ubuntu-branches/ubuntu/karmic/anymeal/karmic

« back to all changes in this revision

Viewing changes to scripts/cookmlToRecipe.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2006-09-17 01:26:36 UTC
  • Revision ID: james.westby@ubuntu.com-20060917012636-f5sttqac644nwofk
Tags: upstream-0.29-3
ImportĀ upstreamĀ versionĀ 0.29-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
3
                version="1.0">
 
4
 
 
5
  <xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8"/>
 
6
 
 
7
  <xsl:template match="/cookml">
 
8
    <cookbook>
 
9
      <xsl:apply-templates select="recipe"/>
 
10
    </cookbook>
 
11
  </xsl:template>
 
12
 
 
13
  <xsl:template match="recipe">
 
14
    <recipe>
 
15
      <title><xsl:value-of select="head/@title"/></title>
 
16
      <categories>
 
17
        <xsl:for-each select="head/cat">
 
18
          <category><xsl:value-of select="."/></category>
 
19
        </xsl:for-each>
 
20
      </categories>
 
21
      <servings>
 
22
        <amount><xsl:value-of select="round(head/@servingqty)"/></amount>
 
23
        <unit><xsl:value-of select="head/@servingtype"/></unit>
 
24
      </servings>
 
25
      <ingredients>
 
26
        <xsl:for-each select="part">
 
27
          <xsl:if test="@title">
 
28
            <title><xsl:value-of select="@title"/></title>
 
29
          </xsl:if>
 
30
          <xsl:for-each select="ingredient">
 
31
            <ingredient>
 
32
              <xsl:if test="@qty">
 
33
                <amount><xsl:value-of select="@qty"/></amount>
 
34
              </xsl:if>
 
35
              <xsl:if test="@unit">
 
36
                <unit><xsl:value-of select="@unit"/></unit>
 
37
              </xsl:if>
 
38
              <name><xsl:value-of select="@item"/></name>
 
39
            </ingredient>
 
40
          </xsl:for-each>
 
41
        </xsl:for-each>
 
42
      </ingredients>
 
43
      <instructions>
 
44
        <xsl:for-each select="preparation/text|preparation/step">
 
45
          <section>
 
46
            <xsl:value-of select="."/>
 
47
          </section>          
 
48
        </xsl:for-each>
 
49
      </instructions>
 
50
    </recipe>
 
51
  </xsl:template>
 
52
 
 
53
</xsl:stylesheet>