<xsl:text><![CDATA[</div>]]></xsl:text>\r
<xsl:text><![CDATA[<div id="content_examples">]]></xsl:text>\r
<!-- examples go here -->\r
- <xsl:apply-templates select="/book/chapter[@id='Extras']/sect1[count(//refentry//refsection//programlisting) > 0]" />\r
+ <xsl:apply-templates select="/book/chapter[@id='Extras']/sect1[count(//refentry//refsection//programlisting) > 0]" />\r
<xsl:text><![CDATA[</div>]]></xsl:text>\r
<xsl:text><![CDATA[</body></html>]]></xsl:text>\r
</xsl:template>\r
</xsl:for-each>\r
</xsl:template>\r
\r
- <xsl:template match="sect1[count(//refentry//refsection//programlisting) > 0]">\r
+ <xsl:template match="sect1[count(//refentry//refsection//programlisting) > 0]">\r
<!--Beginning of section -->\r
- <xsl:variable name="lt"><xsl:text><![CDATA[<]]></xsl:text></xsl:variable>\r
+ <xsl:variable name="lt"><xsl:text><![CDATA[<]]></xsl:text></xsl:variable>\r
+ <xsl:if test="contains(., 'Example')">\r
+ <xsl:text><![CDATA[<table><tr><th colspan="2" class="example_heading">]]></xsl:text>\r
+ <xsl:value-of select="title" /> Examples\r
\r
- <xsl:text><![CDATA[<table><tr><th colspan="2" class="example_heading">]]></xsl:text>\r
- <xsl:value-of select="title" /> Examples\r
+ <!--only pull the first example seciton of each function -->\r
+ <xsl:for-each select="refentry//refsection[contains(title,'Example')][1]/programlisting[1]">\r
<!-- end of section header beginning of function list -->\r
<xsl:text><![CDATA[</th></tr>]]></xsl:text>\r
- <xsl:for-each select="refentry//refsection[contains(title,'Example')]/programlisting[1]">\r
<xsl:variable name='plainlisting'>\r
<xsl:call-template name="globalReplace">\r
<xsl:with-param name="outputString" select="."/>\r
</xsl:call-template>\r
</xsl:variable>\r
\r
-\r
-\r
<!-- add row for each function and alternate colors of rows -->\r
<![CDATA[<tr]]> class="<xsl:choose><xsl:when test="position() mod 2 = 0">evenrow</xsl:when><xsl:otherwise>oddrow</xsl:otherwise></xsl:choose>"<![CDATA[>]]>\r
<![CDATA[<td><b>]]><xsl:value-of select="ancestor::refentry/refnamediv/refname" /><![CDATA[</b><br /><code>]]><xsl:value-of select="$listing" disable-output-escaping="no"/><![CDATA[</code></td></tr>]]>\r
+ \r
</xsl:for-each>\r
<!--close section -->\r
<![CDATA[</table>]]>\r
+ </xsl:if>\r
\r
</xsl:template>\r
\r
\r
#content_functions {\r
float: left;\r
- width:40%;\r
+ width:100%;\r
}\r
\r
#content_examples {\r
- float: right;\r
- width: 58%;\r
+ float: left;\r
+ width: 100%;\r
}\r
\r
.section {\r
<xsl:text><![CDATA[</div>]]></xsl:text>\r
<xsl:text><![CDATA[<div id="content_examples">]]></xsl:text>\r
<!-- examples go here -->\r
- <xsl:apply-templates select="/book/chapter[@id='Topology']/sect1[count(//refentry//refsection//programlisting) > 0]" />\r
+ <xsl:apply-templates select="/book/chapter[@id='Topology']/sect1[count(//refentry//refsection//programlisting) > 0]" />\r
<xsl:text><![CDATA[</div>]]></xsl:text>\r
<xsl:text><![CDATA[</body></html>]]></xsl:text>\r
</xsl:template>\r
</xsl:for-each>\r
</xsl:template>\r
\r
- <xsl:template match="sect1[count(//refentry//refsection//programlisting) > 0]">\r
+ <xsl:template match="sect1[//refentry//refsection[contains(title,'Example')]]">\r
+ <!-- less than needed for converting html tags in listings so they are printable -->\r
+ <xsl:variable name="lt"><xsl:text><![CDATA[<]]></xsl:text></xsl:variable>\r
+ <!-- only print section header if it has examples - not sure why this is necessary -->\r
+ <xsl:if test="contains(., 'Example')">\r
<!--Beginning of section -->\r
- <xsl:variable name="lt"><xsl:text><![CDATA[<]]></xsl:text></xsl:variable>\r
-\r
- <xsl:text><![CDATA[<table><tr><th colspan="2" class="example_heading">]]></xsl:text>\r
+ <xsl:text><![CDATA[<table><tr><th colspan="2" class="example_heading">]]></xsl:text>\r
<xsl:value-of select="title" /> Examples\r
+ <!--only pull the first example section of each function -->\r
+ <xsl:for-each select="refentry//refsection[contains(title,'Example')][1]/programlisting[1]">\r
<!-- end of section header beginning of function list -->\r
<xsl:text><![CDATA[</th></tr>]]></xsl:text>\r
- <xsl:for-each select="refentry//refsection[contains(title,'Example')]/programlisting[1]">\r
<xsl:variable name='plainlisting'>\r
<xsl:call-template name="globalReplace">\r
<xsl:with-param name="outputString" select="."/>\r
\r
<!-- add row for each function and alternate colors of rows -->\r
<![CDATA[<tr]]> class="<xsl:choose><xsl:when test="position() mod 2 = 0">evenrow</xsl:when><xsl:otherwise>oddrow</xsl:otherwise></xsl:choose>"<![CDATA[>]]>\r
- <![CDATA[<td><code>]]><xsl:value-of select="$listing" disable-output-escaping="no"/><![CDATA[</code></td></tr>]]>\r
+ <![CDATA[<td><b>]]><xsl:value-of select="ancestor::refentry/refnamediv/refname" /><![CDATA[</b><br /><code>]]><xsl:value-of select="$listing" disable-output-escaping="no"/><![CDATA[</code></td></tr>]]>\r
</xsl:for-each>\r
- <!--close section -->\r
<![CDATA[</table>]]>\r
+ </xsl:if>\r
+ <!--close section -->\r
+ \r
\r
</xsl:template>\r
\r