Skip to content

Instantly share code, notes, and snippets.

@daverosoff
Last active January 17, 2018 05:40
Show Gist options
  • Save daverosoff/ec9cce16396cfb68fee6b5ee727aa01f to your computer and use it in GitHub Desktop.
Save daverosoff/ec9cce16396cfb68fee6b5ee727aa01f to your computer and use it in GitHub Desktop.
HTML XSLT stylesheet for Survey of Algebra and Probability
<?xml version="1.0" encoding="UTF-8"?> <!-- As XML file -->
<!-- For College of Idaho, -->
<!-- 2016/07/29 R. Beezer, implemented "letter numbers" for sections, -->
<!-- to match existing WeBWorK problem collection -->
<!-- Identify as a stylesheet -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Import the usual LaTeX conversion templates -->
<!-- Place this file in mathbook/user (mkdir if necessary)-->
<xsl:import href="../xsl/mathbook-html.xsl" />
<!-- Intend output for rendering by pdflatex -->
<xsl:output method="html" />
<xsl:template match="chapter" mode="division-serial-number">
<xsl:variable name="n">
<xsl:number count="chapter|references|exercises" />
</xsl:variable>
<xsl:number value="$n - 1" format="1" />
</xsl:template>
<xsl:template match="section" mode="division-serial-number">
<xsl:variable name="n">
<xsl:number count="chapter|references|exercises" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$n=1">
<xsl:variable name="s">
<xsl:number count="section" format="1" />
</xsl:variable>
<xsl:number value="$s - 1" format="1" />
</xsl:when>
<xsl:otherwise>
<xsl:number count="section" format="A" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:param name="html.knowl.example" select="no" />
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment