- Added conditionals for "image" element to output correct source folder for graphics for labs and tutorials.
- Fixed bug (missing bracket) in LaTeX output of "term" element.
 - Added basic Makefile for convenience of building the derived XSLT files.
1 parent adb1720 commit a932745de109aea4d815f2ff25956594bb58dd6f
cedwards authored on 6 Jan 2004
Showing 4 changed files
View
11
Makefile 0 → 100755
# $Id$
 
all: xml2html.xsl xml2latex.xsl
 
xml2html.xsl: format-master.xml xml2xslt.xsl Makefile
Xalan -p format "'html'" format-master.xml xml2xslt.xsl > xml2html.xsl
 
xml2latex.xsl: format-master.xml xml2xslt.xsl Makefile
Xalan -p format "'latex'" format-master.xml xml2xslt.xsl > xml2latex.xsl
 
View
32
format-master.xml
<latex>\textbf{<xsl:apply-templates/>}</latex>
<html><B><xsl:apply-templates/></B></html>
</template>
<template name="term" match="term">
<latex>\term<xsl:apply-templates/>}</latex>
<latex>\term{<xsl:apply-templates/>}</latex>
<html><I CLASS="term"><xsl:apply-templates/></I></html>
</template>
<template name="foreign" match="foreign">
<latex>\foreign{<xsl:apply-templates/>}</latex>
<html><I CLASS="foreign"><xsl:apply-templates/></I></html>
</template>
<template name="code" match="code">
<latex>\code{<xsl:apply-templates/>}</latex>
<!-- <latex>\code{<xsl:apply-templates/>}</latex> -->
<latex>\verb+<xsl:apply-templates/>+</latex>
<html><CODE><xsl:apply-templates/></CODE></html>
</template>
 
<template name="code-block" match="code-block">
</html>
</template>
<!-- Images. Includes a scaling factor for LaTeX. -->
<!-- Images. Includes a scaling factor for LaTeX. To do: alternatively, allow defining the scaling factor by specifying what proportion of the page width the image should occupy. -->
<!-- LaTeX images are always handled the same way regardless. -->
<template match="image" mode="latex">
<latex>
<xsl:text>[scale=</xsl:text>
<xsl:value-of select="latex-scaling"/>
<xsl:text>]</xsl:text>
</xsl:if>
<xsl:text>{images/</xsl:text>
<!-- Use whatever standard image folder is appropriate for the context. -->
<xsl:choose>
<xsl:when test="name(/child::node()[1])='tutorial'">
<xsl:text>{\tutroot/</xsl:text><xsl:value-of select="/tutorial/id/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/tutorial/id/title-code"/><xsl:text>/Graphics/</xsl:text>
</xsl:when>
<xsl:when test="name(/child::node()[1])='laboratory'">
<xsl:text>{\labroot/</xsl:text><xsl:value-of select="/laboratory/id/number-code"/><xsl:text>-</xsl:text><xsl:value-of select="/laboratory/id/title-code"/><xsl:text>/Graphics/</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>{images/</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="basename"/>
<xsl:text>.</xsl:text>
<xsl:choose>
<xsl:when test="count(format) != 0">
View
1508
xml2html.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Whether sample answers should be included in output. This could be an xsl:param rather than an xsl:variable, maybe. -->
<!--/nts-05
<xsl:variable name="showanswers" select="'yes'"/>
-->
<xsl:param name="showanswers" select="'no'"/>
<xsl:output method="html" encoding="ISO-8859-1" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<!-- Make <omit>s (and aliases) disappear. -->
<xsl:template match="omit"/>
<xsl:template match="omission"/>
<xsl:template match="excluded"/>
<xsl:template match="exclusion"/>
<!-- Carry comments through to the output document. (Kind of: "It is an error if instantiating the content of xsl:comment creates nodes other than text nodes.") -->
<xsl:template match="comment">
<xsl:comment>
<xsl:apply-templates/>
</xsl:comment>
</xsl:template>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
 
 
 
<xsl:variable name="web-server-dns" select="'info-nts-05.otago.ac.nz'"/>
<xsl:variable name="web-course-path" select="/info321"/>
<xsl:variable name="web-tut-path" select="$web-course-path/materials"/>
<xsl:variable name="web-lab-path" select="$web-course-path/materials"/>
 
 
<xsl:template name="paper" match="paper"><xsl:apply-templates select="subject-code"/>&#160;<xsl:apply-templates select="paper-number"/></xsl:template>
 
<xsl:template name="PaperCode" match="PaperCode">INFO&#160;321</xsl:template>
<xsl:template name="OracleServer" match="OracleServer">Oracle9<I>i</I></xsl:template>
<!-- Oracle Documentation Links: DO NOT EDIT: generated automatically from Excel -->
 
<xsl:template match="OraAdmin"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96521/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Administrator<xsl:call-template name="apostrophe"/>s Guide</A></xsl:template>
<xsl:template match="OraAppDevOR"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/appdev.920/a96594/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Application Developer<xsl:call-template name="apostrophe"/>s Guide<xsl:call-template name="emdash"/>Object-Relational Features</A></xsl:template>
<xsl:template match="OraConcepts"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96524/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Concepts</A></xsl:template>
<xsl:template match="OraDataWarehousing"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96520/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> </A></xsl:template>
<xsl:template match="OraErrors"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96525/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Error Messages</A></xsl:template>
<xsl:template match="OraSQL"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96540/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> SQL Reference</A></xsl:template>
<xsl:template match="OraJava"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/java.920/a96656/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Java Developer<xsl:call-template name="apostrophe"/>s Guide</A></xsl:template>
<xsl:template match="OraJDBC"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/java.920/a96654/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> JDBC Developer<xsl:call-template name="apostrophe"/>s Guide and Reference</A></xsl:template>
<xsl:template match="OraGlossary"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/mix.920/a97290/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Master Glossary</A></xsl:template>
<xsl:template match="OraTuning"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96533/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Performance Tuning Guide and Reference</A></xsl:template>
<xsl:template match="OraPLSQL"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/appdev.920/a96624/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> PL/SQL User<xsl:call-template name="apostrophe"/>s Guide and Reference</A></xsl:template>
<xsl:template match="OraIndex"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/mix.920/a96625/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Master Index</A></xsl:template>
<xsl:template match="OraReference"><A><xsl:attribute name="HREF">http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96536/toc.htm</xsl:attribute><xsl:call-template name="OracleServer"/> Database Reference</A></xsl:template>
 
<!-- End of Oracle Documentation Links. That'll save a bit o' typing. -->
 
 
<!-- Special characters (should maybe all be named, in case they need to be called explicitly with xsl:call-template) -->
<!-- I'd like to use the Unicode names for these; will look them up some time! -->
<xsl:template name="newline" match="newline"><BR/></xsl:template>
<xsl:template name="non-breaking-space" match="non-breaking-space">&#160;</xsl:template>
<xsl:template match="nbsp"><xsl:call-template name="non-breaking-space"/></xsl:template>
<xsl:template name="ellipsis-sign" match="ellipsis-sign">&#8230;</xsl:template>
<xsl:template match="etc"><xsl:call-template name="ellipsis-sign"/></xsl:template>
<xsl:template match="ellipsis"><xsl:call-template name="ellipsis-sign"/></xsl:template>
<!-- Mathematical symbols -->
<xsl:template name="digit-group-separator" match="digit-group-separator"><xsl:call-template name="non-breaking-space"/></xsl:template>
<xsl:template match="digitsep"><xsl:call-template name="digit-group-separator"/></xsl:template>
<xsl:template name="multiplication-sign" match="multiplication-sign">&#215;</xsl:template>
<xsl:template match="times"><xsl:call-template name="multiplication-sign"/></xsl:template>
<xsl:template match="minus">-</xsl:template>
<xsl:template match="approximately-equal-to">&#8773;</xsl:template>
<xsl:template match="less-than-or-equal-to">&lt;=</xsl:template>
<xsl:template match="less-than">&lt;</xsl:template>
<xsl:template match="greater-than">&gt;</xsl:template>
 
<xsl:template name="endash" match="endash">&#8211;</xsl:template>
<xsl:template name="emdash" match="emdash">&#8212;</xsl:template>
<xsl:template name="apostrophe" match="apostrophe">&#8217;</xsl:template>
<xsl:template match="dollar">$</xsl:template>
<xsl:template name="percent-sign" match="percent-sign">%</xsl:template>
<xsl:template match="percent"><xsl:call-template name="percent-sign"/></xsl:template>
<xsl:template match="ampersand">&amp;</xsl:template>
<xsl:template match="trademark">&#8482;</xsl:template>
<xsl:template name="degree-sign" match="degree-sign">&#176;</xsl:template>
<xsl:template match="degree"><xsl:call-template name="degree-sign"/></xsl:template>
<xsl:template match="section-sign">Section</xsl:template>
<xsl:template match="pi">&#960;</xsl:template>
 
<!-- Special styles -->
<xsl:template match="emph"><EM><xsl:apply-templates/></EM></xsl:template>
<xsl:template match="italic"><I><xsl:apply-templates/></I></xsl:template>
<xsl:template match="quote">&#8220;<xsl:apply-templates/>&#8221;</xsl:template>
<xsl:template match="term"><I CLASS="term"><xsl:apply-templates/></I></xsl:template>
<xsl:template match="foreign"><I CLASS="foreign"><xsl:apply-templates/></I></xsl:template>
 
<!-- More math stuff -->
<xsl:template match="fraction"><SUP><xsl:apply-templates select="numerator"/></SUP>/<SUB><xsl:apply-templates select="denominator"/></SUB></xsl:template>
<xsl:template name="equation-array" match="equation-array"><TABLE CLASS="equation" BORDER="0" ALIGN="CENTER"><xsl:apply-templates/></TABLE></xsl:template>
<!-- No, don't put in an alias, because you'd also need one for eqnarray//row.
<xsl:template match="eqnarray"><xsl:call-template name="equation-array"/></xsl:template> -->
<xsl:template match="equation-array/row"><TR><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR></xsl:template>
<!-- Nope, LaTeX eqnarray can have only three columns, so no need to generalise.
<xsl:template match="equation-array/row/cell"><TD><xsl:attribute name="ALIGN"><xsl:value-of select="@align"/></xsl:attribute><xsl:apply-templates/></TD></xsl:template>
-->
 
<xsl:template match="code"><CODE><xsl:apply-templates/></CODE></xsl:template>
<xsl:template match="code-block">
<PRE CLASS="code">
<xsl:apply-templates/>
</PRE>
</xsl:template>
<!-- Special elements inside code blocks: -->
<xsl:template match="code-block//parameter"><I>&lt;<xsl:apply-templates/>&gt;</I></xsl:template>
<xsl:template match="code-block//hrule">--------------------------------</xsl:template>
<xsl:template match="code-block/server-output"><B><xsl:apply-templates/></B></xsl:template>
<xsl:template match="code-block/query-plan"><B><xsl:apply-templates/></B></xsl:template>
 
<xsl:template match="verbatim"><PRE><xsl:apply-templates/></PRE></xsl:template>
 
 
<!-- pass-through code -->
<xsl:template match="html"><xsl:value-of select="."/></xsl:template>
 
<!-- HTML is weird about what things you cannot include inside paragraphs (e.g. lists of any kind). However, the end P tag is optional, so perhaps let's just not output it. -->
<xsl:template match="paragraph"><P><xsl:apply-templates/></P></xsl:template>
<xsl:template match="para"><P><xsl:apply-templates/></P></xsl:template>
<xsl:template match="p"><P><xsl:apply-templates/></P></xsl:template>
 
 
 
<!-- Figures and included graphics -->
<!-- Dummy:
<xsl:template match="figure">
<pre>
<xsl:apply-templates/>
</pre>
</xsl:template>
-->
<xsl:template match="figure">
<DIV CLASS="figure">
<A><xsl:attribute name="NAME">figure-<xsl:value-of select="id"/><xsl:value-of select="label"/></xsl:attribute></A>
<xsl:apply-templates select="image"/>
<BR/>
<xsl:apply-templates select="caption"/>
</DIV>
</xsl:template>
 
<xsl:template match="image">
<A>
<xsl:attribute name="HREF">Graphics/<xsl:value-of select="basename"/>-600dpi.png</xsl:attribute>
<IMG BORDER="0">
<xsl:attribute name="SRC">Graphics/<xsl:value-of select="basename"/>-72dpi.png</xsl:attribute>
<xsl:attribute name="ALT">image:<xsl:value-of select="basename"/></xsl:attribute>
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="html" encoding="ISO-8859-1" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/><xsl-out:template match="/document"><xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment><HTML><HEAD><LINK REL="Stylesheet" HREF="http://info-nts-05.otago.ac.nz/info321/styles.css" TYPE="text/css"/><TITLE><xsl-out:apply-templates select="title" mode="preamble"/></TITLE></HEAD><BODY><xsl-out:apply-templates/><HR/><ADDRESS><xsl-out:apply-templates select="copyright"/><xsl-out:apply-templates select="id/cvs-id"/></ADDRESS></BODY></HTML></xsl-out:template>
 
<xsl-out:template name="PaperCode" match="PaperCode">
<xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;nbsp;</xsl:text>
<xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
 
<xsl-out:template name="OracleServer" match="OracleServer">Oracle9<I xmlns:xsl="http://www.w3.org/1999/XSL/Transform">i</I></xsl-out:template>
 
 
<xsl-out:template name="paragraph" match="paragraph"><P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template>
<xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template>
<xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template>
<xsl-out:template name="newline" match="newline"><BR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
<xsl-out:template name="page-break" match="page-break"/>
<xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template>
 
<xsl-out:template name="non-breaking-space" match="non-breaking-space"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;nbsp;</xsl:text></xsl-out:template>
<xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template>
 
<xsl-out:template name="ellipsis-sign" match="ellipsis-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8230;</xsl:text></xsl-out:template>
<xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>
<xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>
<xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>
 
<xsl-out:template name="endash" match="endash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8211;</xsl:text></xsl-out:template>
<xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template>
 
<xsl-out:template name="emdash" match="emdash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8212;</xsl:text></xsl-out:template>
<xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template>
 
<xsl-out:template name="apostrophe" match="apostrophe"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8217;</xsl:text></xsl-out:template>
 
<xsl-out:template name="dollar" match="dollar">$</xsl-out:template>
 
<xsl-out:template name="percent-sign" match="percent-sign">%</xsl-out:template>
 
<xsl-out:template name="ampersand" match="ampersand"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;amp;</xsl:text></xsl-out:template>
 
<xsl-out:template name="trademark-sign" match="trademark-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8482;</xsl:text></xsl-out:template>
<xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template>
<xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template>
 
<xsl-out:template name="copyright-sign" match="copyright-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#169;</xsl:text></xsl-out:template>
 
<xsl-out:template name="degree-sign" match="degree-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#176;</xsl:text></xsl-out:template>
<xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template>
 
<xsl-out:template name="section-sign" match="section-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#167;</xsl:text></xsl-out:template>
 
<xsl-out:template name="paragraph-sign" match="paragraph-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#182;</xsl:text></xsl-out:template>
 
<xsl-out:template name="pi" match="pi"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#960;</xsl:text></xsl-out:template>
 
<xsl-out:template name="LaTeX" match="LaTeX">LaTeX</xsl-out:template>
<xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template>
 
<xsl-out:template name="menu-separator" match="menu-separator"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8594;</xsl:text></xsl-out:template>
 
 
<xsl-out:template name="emph" match="emph"><EM xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></EM></xsl-out:template>
<xsl-out:template name="italic" match="italic"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
<xsl-out:template name="strong" match="strong"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template>
<xsl-out:template name="bold" match="bold"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template>
<xsl-out:template name="term" match="term"><I CLASS="term" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
<xsl-out:template name="foreign" match="foreign"><I CLASS="foreign" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
<xsl-out:template name="code" match="code"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template>
 
<xsl-out:template name="code-block" match="code-block">
<PRE CLASS="code" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE>
</xsl-out:template>
<xsl-out:template name="single-quote" match="quote[@single='yes']">
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8216;</xsl:text>
<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8217;</xsl:text>
</xsl-out:template>
<xsl-out:template name="double-quote" match="quote">
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8220;</xsl:text>
<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8221;</xsl:text>
</xsl-out:template>
<xsl-out:template name="nested-double-quote" match="quote//quote">
<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:when test="(count(ancestor::quote) mod 2) = 0">
<xsl:call-template name="double-quote"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="single-quote"/>
</xsl:otherwise>
</xsl:choose>
</xsl-out:template>
<xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2">
<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:when test="(count(ancestor::quote) mod 2) = 0">
<xsl:call-template name="single-quote"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="double-quote"/>
</xsl:otherwise>
</xsl:choose>
</xsl-out:template>
<xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template>
<xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template>
 
 
 
<xsl-out:template name="itemised-list" match="itemised-list">
<UL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</UL>
</xsl-out:template>
<xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
<xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
<xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
<xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
<xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
 
 
<xsl-out:template name="enumerated-list" match="enumerated-list">
<OL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</OL>
</xsl-out:template>
 
<xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
<xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
<xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
<xsl-out:template name="definition-list" match="definition-list">
<!--
Hmm, <DL>s in HTML tend to come out with the spacing a
bit wrong (or maybe it's just my browser?). Might using
a table be better? Messy if the keyword is long,
though, and you don't get a proper hanging indent...
Maybe this is something thaty could be handled in CSS
instead.
-->
<DL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</DL>
<!-- <TABLE BORDER="0" CELLPADDING="10"> -->
<!-- <xsl:apply-templates/> -->
<!-- </TABLE> -->
</xsl-out:template>
<xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template>
 
 
<xsl-out:template name="item" match="item">
<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:when test="count(paragraph|para|p) != 0">
<LI><xsl:apply-templates/></LI>
</xsl:when>
<xsl:otherwise>
<LI><P><xsl:apply-templates/></P></LI>
</xsl:otherwise>
</xsl:choose>
</xsl-out:template>
 
<xsl-out:template name="definition-item" match="definition-list/item">
<DT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><P><xsl:apply-templates select="keyword"/></P></DT>
<DD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="definition|description|discourse"/></DD>
<!-- <TR VALIGN="TOP"> -->
<!-- <TD><P><xsl:apply-templates select="keyword"/></P></TD> -->
<!-- <TD><xsl:apply-templates select="definition|description|discourse"/></TD> -->
<!-- </TR> -->
</xsl-out:template>
<xsl-out:template name="keyword" match="keyword"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template>
<xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template>
<xsl-out:template name="definition" match="item/definition|item/description|item/discourse">
<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:when test="count(paragraph|para|p) != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<P><xsl:apply-templates/></P>
</xsl:otherwise>
</xsl:choose>
</xsl-out:template>
<xsl-out:template name="section" match="section">
<xsl:if test="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><A NAME="{@label}"/></xsl:if>
<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:if test="count(.//footnote) &gt; 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<P><STRONG>Notes:</STRONG></P>
<xsl:apply-templates select=".//footnote" mode="list"/>
</xsl:if>
</xsl-out:template>
<xsl-out:template name="footnote" match="footnote">
<A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute name="NAME">
<xsl:text>footnote-</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>-source</xsl:text>
</xsl:attribute>
<xsl:attribute name="HREF">
<xsl:text>#footnote-</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>-target</xsl:text>
</xsl:attribute>
<xsl:text>[</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>]</xsl:text>
</A>
</xsl-out:template>
 
<xsl-out:template name="footnote-list" match="footnote" mode="list">
<P xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<A>
<xsl:attribute name="NAME">
<xsl:text>footnote-</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>-target</xsl:text>
</xsl:attribute>
<xsl:text>[</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>]</xsl:text>
</A>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text> </xsl:text>
<A>
<xsl:attribute name="HREF">
<xsl:text>#footnote-</xsl:text>
<xsl:number level="any" count="footnote"/>
<xsl:text>-source</xsl:text>
</xsl:attribute>
<xsl:text>[Back]</xsl:text>
</A>
</P>
</xsl-out:template>
 
<xsl-out:template name="preamble-title" match="document/title" mode="preamble">
<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
 
<xsl-out:template name="preamble-author" match="document/author" mode="preamble"/>
 
<xsl-out:template name="preamble-date" match="document/date" mode="preamble"/>
 
<xsl-out:template name="document-title" match="document/title">
<H1 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></H1>
</xsl-out:template>
<xsl-out:template name="document-author" match="document/author"/>
<xsl-out:template name="document-date" match="document/date"/>
 
<xsl-out:template name="generate-subs"/>
<xsl-out:template name="section-title" match="section/title">
<xsl:variable name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:number value="1 + count(ancestor::section)"/>
<xsl:if test="1 + count(ancestor::section) &gt; 6">6</xsl:if>
</xsl:variable>
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&gt;</xsl:text>
<xsl:number count="section" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text>
<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;/H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&gt;</xsl:text>
</xsl-out:template>
 
 
<xsl-out:template name="quotation" match="quotation">
<P xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:if test="@align">
<xsl:attribute name="ALIGN">
<xsl:value-of select="@align"/>
</xsl:attribute>
</xsl:if>
<I><xsl:apply-templates/></I>
</P>
</xsl-out:template>
<xsl-out:template name="id" match="id"/>
<xsl-out:template name="omit" match="omit"/>
<xsl-out:template name="tabular" match="tabular">
<TABLE xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute name="BORDER">
<xsl:value-of select="@border"/>
<xsl:if test="not(@border)">0</xsl:if>
</xsl:attribute>
<xsl:if test="@align">
<xsl:attribute name="ALIGN">
<xsl:value-of select="@align"/>
</xsl:attribute>
</xsl:if>
<!--
Note different ordering of tabular components:
HTML requires THEAD and TFOOT to precede TBODY.
-->
<xsl:apply-templates select="tabular-header"/>
<xsl:apply-templates select="tabular-footer"/>
<xsl:apply-templates select="tabular-body"/>
</TABLE>
</xsl-out:template>
<xsl-out:template name="aligned-column" match="column[@align]"/>
<xsl-out:template name="unaligned-column" match="column[not(@align)]"/>
<xsl-out:template name="tabular-header" match="tabular-header">
<THEAD xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</THEAD>
</xsl-out:template>
 
<xsl-out:template name="tabular-footer" match="tabular-footer">
<TFOOT xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</TFOOT>
</xsl-out:template>
 
<xsl-out:template name="tabular-body" match="tabular-body">
<TBODY xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</TBODY>
</xsl-out:template>
 
<xsl-out:template name="row" match="row">
<TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:apply-templates/>
</TR>
</xsl-out:template>
 
<xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]"/>
 
<xsl-out:template name="row-rule-partial" match="row-rule[@columns]"/>
<xsl-out:template match="cell" mode="multi-row"/>
<xsl-out:template match="cell" mode="multi-column"/>
<xsl-out:template match="cell">
<!-- position() doesn't seem to work very well in this context -->
<xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable>
<TD xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute name="ALIGN">
<xsl:value-of select="@align"/>
<xsl:if test="not(@align)">
<xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/>
<xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if>
</xsl:if>
</xsl:attribute>
<xsl:attribute name="COLSPAN">
<xsl:value-of select="@columns"/>
<xsl:if test="not(@columns)">1</xsl:if>
</xsl:attribute>
<xsl:attribute name="ROWSPAN">
<xsl:value-of select="@rows"/>
<xsl:if test="not(@rows)">1</xsl:if>
</xsl:attribute>
<xsl:apply-templates/>
</TD>
</xsl-out:template>
<xsl-out:template name="hyperlink-label" match="hyperlink[@label]"><A HREF="#{@label}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template>
 
<xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template>
 
<xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><CODE><xsl:value-of select="@url"/></CODE></A></xsl-out:template>
<xsl-out:template name="url" match="url"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template>
<xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template>
<xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template>
<xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template>
 
 
<xsl-out:template name="reference" match="reference">
<!-- Find the element whose label is the same as our label. -->
<xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="section-reference" match="section" mode="reference">
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Section&amp;#160;</xsl:text>
<xsl:number count="figure" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="figure-reference" match="figure" mode="reference">
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure&amp;#160;</xsl:text>
<xsl:number count="figure" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="table-reference" match="table" mode="reference">
<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table&amp;#160;</xsl:text>
<xsl:number count="table" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="figure" match="figure">
<DIV CLASS="figure" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:if test="@label"><A NAME="{@label}"/></xsl:if>
<xsl:apply-templates select="*[not(self::caption)]"/>
<xsl:if test="count(caption) != 0">
<BR/>
<xsl:apply-templates select="caption"/>
</xsl:if>
</DIV>
</xsl-out:template>
<xsl-out:template name="table" match="table">
<DIV CLASS="table" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:if test="@label"><A NAME="{@label}"/></xsl:if>
<xsl:apply-templates select="*[not(self::caption)]"/>
<xsl:if test="count(caption) != 0">
<BR/>
<xsl:apply-templates select="caption"/>
</xsl:if>
</DIV>
</xsl-out:template>
<xsl-out:template name="figure-caption" match="figure/caption">
<STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="table-caption" match="table/caption">
<STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template match="image" mode="latex"/>
<xsl-out:template match="image[count(provide-large-version) = 0]">
<IMG BORDER="0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute name="SRC">
<xsl:text>images/</xsl:text>
<xsl:value-of select="basename"/>
<xsl:text>.</xsl:text>
<xsl:choose>
<xsl:when test="count(format) != 0">
<xsl:value-of select="format"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>png</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute>
</IMG>
</A>
</xsl:template>
 
 
<xsl:template match="eqnarray">
<pre>
<xsl:apply-templates/>
</pre>
</xsl:template>
 
<!-- Table element handling -->
 
<xsl:template match="table">
<TABLE>
</TABLE>
</xsl:template>
 
<xsl:template match="table/row">
<TR>
</TR>
</xsl:template>
<xsl:template match="table/row/cell">
<TD>
<xsl:apply-templates/>
</TD>
</xsl:template>
<!-- <xsl:template match="tutorial/title"><H1><xsl:apply-templates/></H1></xsl:template> -->
<!-- Need to work out heading level based on section nesting - might be tricky (both for HTML and for LaTeX). -->
<!-- Do we want to simply allow sections within sections, or make it explicit in the XML what level the section should be at? -->
<xsl:template match="/tutorial/section/title">
<H2>
<xsl:apply-templates/>
</H2>
</xsl:template>
<xsl:template match="/laboratory/section/title">
<H2>
<xsl:apply-templates/>
</H2>
</xsl:template>
 
<xsl:template match="/tutorial/section/section/title">
<H3>
<xsl:apply-templates/>
</H3>
</xsl:template>
<xsl:template match="/laboratory/section/section/title">
<H3>
<xsl:apply-templates/>
</H3>
</xsl:template>
 
<xsl:template match="introduction">
<h2>Introduction</h2>
<xsl:apply-templates/>
</xsl:template>
<!-- Lists of various kinds -->
<!-- Itemised, unordered, bullet points -->
<xsl:template name="itemised-list" match="itemised-list">
<UL>
<xsl:apply-templates/>
</UL>
</xsl:template>
<xsl:template match="itemised-list/item">
<LI>
<xsl:apply-templates/>
</LI>
</xsl:template>
<!-- For LaTeX compatibility: -->
<xsl:template match="itemize"><xsl:call-template name="itemised-list"/></xsl:template>
<xsl:template match="unordered-list"><xsl:call-template name="itemised-list"/></xsl:template>
<xsl:template match="bulleted-list"><xsl:call-template name="itemised-list"/></xsl:template>
<xsl:template match="bullet-list"><xsl:call-template name="itemised-list"/></xsl:template>
<xsl:template match="bullet-points"><xsl:call-template name="itemised-list"/></xsl:template>
<xsl:template match="itemize/item">
<LI>
<xsl:apply-templates/>
</LI>
</xsl:template>
 
 
<!-- Enumerated, ordered, numbered points -->
<xsl:template name="enumerated-list" match="enumerated-list">
<OL>
<xsl:apply-templates/>
</OL>
</xsl:template>
<xsl:template match="enumerated-list/item">
<LI>
<xsl:apply-templates/>
</LI>
</xsl:template>
<!-- For LaTeX compatibility: -->
<xsl:template match="enumerate"><xsl:call-template name="enumerated-list"/></xsl:template>
<xsl:template match="ordered-list"><xsl:call-template name="enumerated-list"/></xsl:template>
<xsl:template match="numbered-list"><xsl:call-template name="enumerated-list"/></xsl:template>
 
<xsl:template match="question-list">
<OL class="questions">
<xsl:apply-templates/>
</OL>
</xsl:template>
<xsl:template match="question-list/item">
<LI class="question">
<xsl:apply-templates/>
</LI>
</xsl:template>
<xsl:template match="definition-list">
<DL>
<xsl:apply-templates/>
</DL>
</xsl:template>
 
<!-- <keyword> and <term> are synonymous in the context definition-list/item -->
<xsl:template match="definition-list/item/keyword">
<DT><xsl:apply-templates/></DT>
</xsl:template>
<xsl:template match="definition-list/item/term">
<DT><xsl:apply-templates/></DT>
</xsl:template>
 
<xsl:template match="definition-list/item/definition">
<DD><xsl:apply-templates/></DD>
</xsl:template>
<!-- <xsl:template match="definition-list/item"><xsl:apply-templates/></xsl:template> -->
<!-- This doesn't work (in Xalan v?.?) - produces a <DT></DT>...<DD></DD> for some reason. -->
<xsl:template match="definition-list/item/keyword"><DT/><xsl:apply-templates/><DD/></xsl:template>
<!--
Processing answer sections for tutorials and labs. If the document says that answers should be displayed, then do, otherwise do not.
We could (i.e. should) get gnarly and make it so you can turn answers on/off for each tutorial and lab.
-->
<xsl:template match="answer">
<xsl:if test="$showanswers='yes'">
<DIV CLASS="answer">
<xsl:apply-templates/>
</DIV>
</xsl:if>
</xsl:template>
 
 
 
<!-- Cross-references. Eewww? Getting these to work nicely in both LaTeX and HTML could be ick. -->
<xsl:template name="reference" match="reference">
<A>
<xsl:if test="type='figure'">
<xsl:attribute name="HREF">#figure-<xsl:value-of select="target"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates select="label"/>
</A>
</xsl:template>
<!-- alias -->
<xsl:template match="ref"><xsl:call-template name="reference"/></xsl:template>
<!-- Links to URLs. -->
<xsl:template match="netlink">
<A>
<xsl:attribute name="HREF"><xsl:value-of select="target"/></xsl:attribute>
<xsl:apply-templates select="label"/>
</A>
</xsl:template>
 
<!-- URLs that should appear verbatim in the output. -->
<xsl:template match="url">
<A>
<xsl:attribute name="HREF"><xsl:value-of select="."/></xsl:attribute>
<CODE><xsl:value-of select="."/></CODE>
</A>
</xsl:template>
 
 
 
<!-- Menu items and paths -->
<xsl:template match="menu/item"><B><xsl:apply-templates/></B></xsl:template>
<xsl:template name="menu-separator" match="menu/separator">&#8594;</xsl:template>
<xsl:template match="menusep"><xsl:call-template name="menu-separator"/></xsl:template>
 
 
 
 
<!-- Top-level document match -->
<xsl:template match="/">
<!-- <xsl:value-of select="$showanswers"/> -->
<!-- <xsl:message>showanswers=<xsl:value-of select="$showanswers"/>: Sample answers will be displayed.</xsl:message> -->
<HTML>
<HEAD>
<LINK REL="Stylesheet" HREF="http://info-nts-05.otago.ac.nz/info321/styles.css" TYPE="text/css"/>
<TITLE>
<xsl:if test="name(child::node()[1])='tutorial'">
INFO&#160;321 Tutorial <xsl:value-of select="/tutorial/id/number"/>&#160;<xsl:if test="$showanswers='yes'">Sample Answers</xsl:if>: <xsl:apply-templates select="/tutorial/title"/>
</xsl:if>
 
<xsl:if test="name(child::node()[1])='laboratory'">
INFO&#160;321 Laboratory <xsl:value-of select="/laboratory/id/number"/>&#160;<xsl:if test="$showanswers='yes'">Sample Answers</xsl:if>: <xsl:apply-templates select="/laboratory/title"/>
</xsl:if>
</TITLE>
</HEAD>
<BODY>
<H1>
<!-- testing
<xsl:value-of select="name(child::node()[1])"/>
-->
<xsl:if test="name(child::node()[1])='tutorial'">
INFO&#160;321 Tutorial <xsl:value-of select="/tutorial/id/number"/>&#160;<xsl:if test="$showanswers='yes'">Sample Answers</xsl:if>: <BR/><xsl:apply-templates select="/tutorial/title"/>
</xsl:if>
<xsl:if test="name(child::node()[1])='laboratory'">
INFO&#160;321 Laboratory <xsl:value-of select="/laboratory/id/number"/>&#160;<xsl:if test="$showanswers='yes'">Sample Answers</xsl:if>: <BR/><xsl:apply-templates select="/laboratory/title"/>
</xsl:if>
</H1>
 
<!-- Laziness: -->
<xsl:apply-templates select="/tutorial/introduction"/>
<xsl:apply-templates select="/laboratory/introduction"/>
 
<xsl:for-each select="/tutorial/section">
<xsl:apply-templates/>
</xsl:for-each>
 
<xsl:for-each select="/laboratory/section">
<xsl:apply-templates/>
</xsl:for-each>
 
<ADDRESS>
<xsl:apply-templates select="//id/cvs-id"/>
</ADDRESS>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
</xsl-out:template>
 
<xsl-out:template match="image[count(provide-large-version) != 0]">
<A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute name="HREF">
<xsl:text>images/</xsl:text>
<xsl:value-of select="basename"/>
<xsl:text>-zoom.</xsl:text>
<xsl:choose>
<xsl:when test="count(format) != 0">
<xsl:value-of select="format"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>png</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<IMG BORDER="0">
<xsl:attribute name="SRC">
<xsl:text>images/</xsl:text>
<xsl:value-of select="basename"/>
<xsl:text>.</xsl:text>
<xsl:choose>
<xsl:when test="count(format) != 0">
<xsl:value-of select="format"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>png</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="ALT">
<xsl:apply-templates select="description"/>
</xsl:attribute>
</IMG>
<BR CLEAR="right"/>
<xsl:text>(Larger version)</xsl:text>
</A>
</xsl-out:template>
<xsl-out:template name="include-xml" match="include-document">
<xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</xsl-out:template>
<xsl-out:template name="environment" match="environment[@file]"/>
<xsl-out:template name="latex-package" match="latex-packages/package"/>
<xsl-out:template name="latex-command" match="latex-packages/command"/>
<xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"/>
<xsl-out:template name="raw-html" match="raw-code[@format = 'html']"><xsl:copy-of select="*" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
<xsl-out:template name="latex-input" match="latex-input"/>
 
<xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"/>
<xsl-out:template name="process-when-html" match="process-when[@format = 'html']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
<xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
<xsl-out:template name="math-display" match="math"><P ALIGN="center" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template>
<xsl-out:template name="superscript" match="math//superscript"><SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUP></xsl-out:template>
<xsl-out:template name="subscript" match="math//subscript"><SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUB></xsl-out:template>
<xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template>
<xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template>
<xsl-out:template name="times-operator" match="math//times"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> &amp;#215; </xsl:text></xsl-out:template>
<xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template>
<xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template>
<xsl-out:template name="log-like-function" match="math//function"><xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
<xsl-out:template name="math-variable" match="math//variable"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
<xsl-out:template name="math-fraction" match="math//fraction"><xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><BIG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> / </BIG><xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
 
</xsl-out:stylesheet>
View
xml2latex.xsl