Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-fiddle.git
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:r="http://www.whitemagicsoftware.com/software/recipe"
  xmlns:string="http://symphony-cms.com/functions"
  xmlns:str="http://exslt.org/strings"
  exclude-result-prefixes="r str string">

<xsl:import href="string-utilities.xsl" />
<xsl:import href="fractions.xsl" />
<xsl:import href="constants.xsl" />

<xsl:output
  method="xml" encoding="UTF-8" indent="no"
  omit-xml-declaration="yes" standalone="yes" media-type="text/xhtml"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />

<xsl:param name="language">en</xsl:param>
<xsl:param name="cookie"></xsl:param>

<xsl:strip-space elements="*" />

<!-- Discard empty nodes. -->
<xsl:template match="*[not(@*) and not(*) and not(text())]" />

<!--
 | The entire site is based on the HTML in this template.
 +-->
<xsl:template match="/">
<html xml:lang="{$language}" lang="{$language}">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title><xsl:call-template name="page-title" /> - <xsl:value-of select="$DEFAULT_APP_TITLE" /></title>
  <!--base href="{$BASE_APP}" /-->

  <link rel="stylesheet" type="text/css" href="{$BASE_APP}css/ui.css" />
  <xsl:call-template name="html-head" />
</head>
<body id="doc">
<div id="content">
  <div id="header">
    <div id="header-branding">
      <xsl:call-template name="body-header-branding" />
    </div>
    <div id="header-nav-container">
      <div id="header-nav">
        <xsl:call-template name="body-header-nav" />
      </div>
    </div>
  </div>
  <div id="app">
    <div id="app-nav-container">
      <div id="app-nav">
        <xsl:call-template name="body-app-nav" />
      </div>
    </div>
    <div id="app-content-container">
      <div id="app-content">
        <xsl:apply-templates />
      </div>
    </div>
    <div id="app-footer">
      <xsl:call-template name="body-app-footer" />
    </div>
  </div>
  <div id="footer">
    <xsl:call-template name="body-footer" />
  </div>
</div>
</body>
</html>
</xsl:template>

<xsl:template name="body-header-branding">
  <p class="header-site-title">
    <xsl:value-of select="$DEFAULT_APP_TITLE" />
  </p>
</xsl:template>

<xsl:template name="body-header-nav">
  <!-- TODO: Fix print-friendly version -->
<!--
  <a href="javascript:window.print();"><span
     class="icon"><img src="{$BASE_ICON_APP}print.png"
     width="32" height="32"
     id="print-page" class="no-print"
     alt="Print Page" title="Print Page" /></span></a>
  <xsl:text> </xsl:text>
  -->
  <a href="{$BASE_SEARCH}" class="header-nav-icon"
     id="nav-search"
     title="Recipe Search"><span
     class="icon header-nav-icon no-print" id="header-nav-search"><img
     src="{$BASE_ICON_APP}search.png"
     width="32" height="32" 
     alt="Recipe Search" /></span></a>
  <xsl:text> </xsl:text>
  <a href="{$BASE_RECIPE}?command=create-recipe" class="header-nav-icon"
     id="nav-recipe"
     title="Add New Recipe"><span
     class="icon header-nav-icon" id="header-nav-recipe"><img
     src="{$BASE_ICON_APP}recipe.png"
     width="32" height="32"
     alt="Add Recipe" /></span></a>
  <xsl:text> </xsl:text>
  <a href="{$BASE_BOOK}" class="header-nav-icon"
     id="nav-book"
     title="Create Book"><span
     class="icon header-nav-icon no-print" id="header-nav-book"><img
     src="{$BASE_ICON_APP}book.png"
     width="32" height="32"
     alt="Create Book" /></span></a>
  <xsl:text> </xsl:text>
  <!--
  <a href="{$BASE_GROCERY}" class="header-nav-icon"
     title="Grocery Lists"><span
     class="icon header-nav-icon no-print" id="header-nav-grocery"><img
     src="{$BASE_ICON_APP}grocery.png"
     width="32" height="32"
     alt="Grocery Lists" /></span></a>
  <xsl:text> </xsl:text>
  <a href="{$BASE_DIET}" class="header-nav-icon"
     title="Dietary Preferences"><span
     class="icon header-nav-icon no-print" id="header-nav-diet"><img
     src="{$BASE_ICON_APP}diet.png"
     width="32" height="32"
     alt="Dietary Preferences" /></span></a>
  <xsl:text> </xsl:text>
  <a href="{$BASE_POTLUCK}" class="header-nav-icon"
     title="Create Potluck"><span
     class="icon header-nav-icon no-print" id="header-nav-potluck"><img
     src="{$BASE_ICON_APP}potluck.png"
     width="32" height="32"
     alt="Create Potluck" /></span></a>
  <xsl:text> </xsl:text>
  -->
  <a href="{$BASE_ACCOUNT}" class="header-nav-icon"
     id="nav-account"
     title="Recipe List"><span
     class="icon header-nav-icon no-print" id="header-nav-account"><img
     src="{$BASE_ICON_APP}account.png"
     width="32" height="32"
     alt="Recipe List" /></span></a>
  <xsl:text> </xsl:text>
  <a href="{$BASE_LOGIN}" class="header-nav-icon"
     id="nav-login"
     title="Log In"><span
     class="icon header-nav-icon no-print" id="header-nav-login"><img
     src="{$BASE_ICON_APP}login.png"
     width="32" height="32" 
     alt="Log In" /></span></a>
</xsl:template>

<xsl:template name="body-app-nav">
</xsl:template>

<xsl:template name="body-app-footer">
</xsl:template>

<xsl:template name="body-page-footer">
</xsl:template>

<xsl:template name="body-footer">
  <xsl:call-template name="body-page-footer" />
  <a href="mailto:recipefiddle@gmail.com" class="contact" target="_email"><img src="{$BASE_ICON}email.png"
     class="contact" width="32" height="32" alt="Contact" /></a>
</xsl:template>

<!--
 | Used whenever a user can delete an item.
 +-->
<xsl:template name="delete-button">
  <xsl:param name="p_name" />
  <xsl:param name="p_id" />
  <xsl:param name="p_value" />
  <xsl:param name="p_title" select="'Delete'" />

  <!-- Prevent spaces for the identifiers for the value. -->
  <xsl:variable name="value"><xsl:value-of select="translate( $p_value, ' ', '-' )" /></xsl:variable>

  <!-- Ballot X for delete. -->
  <button
    name="{$p_name}"
    id="{$p_id}-{$value}"
    value="{$p_value}"
    class="delete-item no-print unselectable"
    title="{$p_title}"
    unselectable="on">&#x2717;</button>
</xsl:template>

<!--
 | Used whenever a user can add an item.
 | TODO: Merge with delete-button
 +-->
<xsl:template name="add-button">
  <xsl:param name="p_name" />
  <xsl:param name="p_id" />
  <xsl:param name="p_value" />
  <xsl:param name="p_title" select="'Add'" />

  <!-- Prevent spaces for the identifiers for the value. -->
  <xsl:variable name="value"><xsl:value-of select="translate( $p_value, ' ', '-' )" /></xsl:variable>

  <!-- Use + for add. -->
  <button
    name="{$p_name}"
    id="{$p_id}-{$value}"
    value="{$p_value}"
    class="add-item no-print unselectable"
    title="{$p_title}"
    unselectable="on">+</button>
</xsl:template>

<xsl:template name="html-head"></xsl:template>

<!-- jQuery 1.9.1 includes autocomplete; missing in 1.10.3? -->
<xsl:template name="include-client-framework">
  <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" charset="utf-8"></script>
</xsl:template>

<xsl:template name="page-title">
</xsl:template>

<xsl:template match="*" />

</xsl:stylesheet>