]> granicus.if.org Git - postgis/commitdiff
more cleanup -- only print example sections if they have examples
authorRegina Obe <lr@pcorp.us>
Mon, 31 Oct 2011 05:32:43 +0000 (05:32 +0000)
committerRegina Obe <lr@pcorp.us>
Mon, 31 Oct 2011 05:32:43 +0000 (05:32 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8058 b70326c6-7e19-0410-871a-916f4a2858ee

doc/xsl/tiger_geocoder_cheatsheet.html.xsl
doc/xsl/topology_cheatsheet.html.xsl

index e5ccd76a651939ca5f5dc33174a5c5d57995b31d..b607c2ee5a8c13d969ad55b7d06d7e7c613fe97b 100644 (file)
@@ -83,7 +83,7 @@ h1 {
                        <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) &gt; 0]"  />\r
                        <xsl:text><![CDATA[</div>]]></xsl:text>\r
                        <xsl:text><![CDATA[</body></html>]]></xsl:text>\r
 </xsl:template>\r
@@ -106,15 +106,17 @@ h1 {
                </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) &gt; 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
@@ -129,14 +131,14 @@ h1 {
                                        </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
index 2f24a88d3857d1e9e6b3f8571c0b481631cfecda..a3e9c8880017342bb6752ff15f0ed8fa6b9f403e 100644 (file)
@@ -30,12 +30,12 @@ body {
 \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
@@ -82,7 +82,7 @@ h1 {
                        <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) &gt; 0]"  />\r
                        <xsl:text><![CDATA[</div>]]></xsl:text>\r
                        <xsl:text><![CDATA[</body></html>]]></xsl:text>\r
 </xsl:template>\r
@@ -105,15 +105,18 @@ h1 {
                </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
@@ -132,10 +135,12 @@ h1 {
 \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