Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-fiddle.git
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:string="http://symphony-cms.com/functions"
  exclude-result-prefixes="string">

<!--
 | The book's front matter: cover, copyright, and table of contents.
 +-->
<xsl:template match="book" mode="frontmatter">
\startfrontmatter
\setuppagenumbering[conversion=romannumerals]
\setcounter[userpage][1]
<xsl:apply-templates select="title" mode="frontmatter" />
<xsl:apply-templates select="author" mode="frontmatter" />
<xsl:apply-templates select="photo" mode="frontmatter" />
<xsl:if test="not(photo)">
  <xsl:call-template name="cover-page" />
</xsl:if>
<xsl:apply-templates select="copyright" mode="frontmatter" />
\setupbackgrounds[page][background=RecipeStyleChapterBackground]
<!-- Table of contents -->
<xsl:if test="$recipe-toc">
\RecipeTableOfContents
</xsl:if>
\stopfrontmatter
</xsl:template>

<xsl:template match="title" mode="frontmatter">
\def\RecipeTextBookTitle{<xsl:apply-templates />}</xsl:template>

<xsl:template match="author" mode="frontmatter">
\def\RecipeTextBookAuthor{<xsl:choose>
  <xsl:when test="not($book-author)"><xsl:value-of select="." /></xsl:when>
  <xsl:otherwise><xsl:value-of select="$book-author" /></xsl:otherwise>
</xsl:choose>}
</xsl:template>

<!--
 | Use a default cover when no picture is provided.
 +-->
<xsl:template name="cover-page">
\setupbackgrounds[page][background=RecipeStyleCoverFrontBackground]
\startstandardmakeup
  \RecipeBookCoverFrontContent
\stopstandardmakeup
\setupbackgrounds[page][background=]
</xsl:template>

<xsl:template match="photo[@use='front-cover']" mode="frontmatter">
<xsl:apply-templates select="uri" mode="frontmatter" />
\startstandardmakeup
\stopstandardmakeup
\setupbackgrounds[page][background=RecipeStyleChapterBackground]
</xsl:template>

<xsl:template match="uri" mode="frontmatter">
\RecipeBookPictureFrontCover{<xsl:apply-templates />}
\setupbackgrounds[page][background=page:RecipeBookCoverPicture]
</xsl:template>

<xsl:template match="copyright" mode="frontmatter">
\startcopyrightmakeup
  \RecipeBookCopyrightTitle{<xsl:value-of select="../title" />}
  \RecipeBookCopyrightAuthor{<xsl:value-of select="../author" />}
  <xsl:apply-templates mode="frontmatter" />
  \RecipeBookCopyrightDesign{\href{\RecipeTextDesignerName}{\RecipeTextDesignerURL}}
  \RecipeBookCopyrightSoftware{}
\stopcopyrightmakeup
</xsl:template>

<!-- Copyright holder. -->
<xsl:template match="holder" mode="frontmatter">\RecipeBookCopyrightHolder{<xsl:apply-templates />}</xsl:template>

<!-- Book publisher information (name, address, etc.). -->
<xsl:template match="publisher" mode="frontmatter">
  <xsl:apply-templates mode="frontmatter" />
  \RecipeBookCopyrightDisclaimer{}</xsl:template>

<xsl:template match="license" mode="frontmatter">
  \RecipeBookCopyrightLicense{<xsl:apply-templates mode="frontmatter" />}</xsl:template>

<xsl:template match="name" mode="frontmatter">
  \RecipeBookCopyrightPublisher{<xsl:apply-templates />}{<xsl:value-of select="../address/city" />}{<xsl:value-of select="../address/region" />}
</xsl:template>

<xsl:template match="address" mode="frontmatter">
  <xsl:apply-templates mode="frontmatter" />
</xsl:template>

<xsl:template match="street/line" mode="frontmatter">
  \RecipeBookCopyrightAddressStreet{<xsl:apply-templates />}
</xsl:template>

<!--
<xsl:template match="city|region|country|code" mode="frontmatter">
  \RecipeBookCopyrightAddress<xsl:value-of select="string:capitalize(local-name())" />{<xsl:apply-templates />}</xsl:template>
-->

<xsl:template match="trademarks" mode="frontmatter">
  <xsl:apply-templates mode="frontmatter" />
</xsl:template>

<xsl:template match="trademark" mode="frontmatter">
  \RecipeBookCopyrightTrademark{<xsl:apply-templates />}</xsl:template>

<xsl:template match="*" mode="frontmatter" />

</xsl:stylesheet>