1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="db"
>
<xsl:variable name='new_tag' select='"availability"' />
<xsl:variable name='geos_tag' select='"geos_requirement"' />
<xsl:variable name='sfcgal_tag' select='"sfcgal_requirement"' />
<xsl:variable name='enhanced_tag' select='"enhanced"' />
<xsl:variable name='sqlmm_conformance_tag' select='"sqlmm"' />
<xsl:variable name='Z_conformance_tag' select='"3d"' />
<xsl:variable name='geography_tag' select='"geography_support"' />
<xsl:variable name='curve_conformance_tag' select='"curve"' />
<xsl:variable name='include_examples'>false</xsl:variable>
<xsl:variable name='output_purpose'>true</xsl:variable>
<xsl:variable name='linkstub'>https://postgis.net/docs/manual-<xsl:value-of select="$postgis_version" />/<xsl:value-of select="$postgis_language" /></xsl:variable>
<xsl:variable name="cheatsheets_config" select="document('xsl-config.xml')//cheatsheets" />
<!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->
<xsl:template name="list_in_params">
<xsl:param name="func" />
<xsl:for-each select="$func">
<xsl:if test="count(db:paramdef/db:parameter) > 0"> </xsl:if>
<xsl:for-each select="db:paramdef">
<xsl:choose>
<xsl:when test="not( contains(db:parameter, 'OUT') )">
<xsl:value-of select="db:parameter" />
<xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '
')">
<xsl:value-of select="substring-before($text, '
')"/>
<![CDATA[<br/>]]>
<xsl:call-template name="break">
<xsl:with-param
name="text"
select="substring-after($text, '
')"
/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:chapter" name="function_list_html">
<div id="content_functions_left">
<xsl:variable name="col_func_count"><xsl:value-of select="count(descendant::*//db:funcprototype) div 1.65" /></xsl:variable>
<!--count(preceding-sibling::*/db:refentry/db:refsynopsisdiv/db:funcsynopsis/db:funcprototype)-->
<xsl:for-each select="db:section[count(//db:funcprototype) > 0 ]">
<xsl:apply-templates select="." />
</xsl:for-each>
</div>
</xsl:template>
<xsl:template match="db:section">
<xsl:variable name="col_cur"><xsl:value-of select="count(current()//db:funcprototype) + count(preceding-sibling::*//db:funcprototype)"/></xsl:variable>
<!--
<xsl:if test="$col_cur >$col_func_count and count(preceding-sibling::*//db:funcprototype) < $col_func_count ">
</div><div id="content_functions_right">
</xsl:if>
-->
<!--Beginning of section -->
<table class="section"><tr><th colspan="2"><xsl:value-of select="db:title" />
<!-- end of section header beginning of function list -->
</th></tr>
<xsl:for-each select="current()//db:refentry">
<xsl:variable name="ref" select="." />
<!-- add row for each function and alternate colors of rows -->
<!-- , hyperlink to online manual -->
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">evenrow</xsl:when>
<xsl:otherwise>oddrow</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td colspan='2'>
<span class='func'>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="concat(concat($linkstub, @xml:id), '.html')" />
</xsl:attribute>
<xsl:value-of select="db:refnamediv/db:refname" />
</a>
</span>
<xsl:if test="$ref//db:para[@role=$new_tag and starts-with(@conformance, $postgis_version)]">
<sup>1</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$enhanced_tag and starts-with(@conformance, $postgis_version)]">
<sup>2</sup>
</xsl:if>
<xsl:if test="$ref/descendant::*[@conformance=$sqlmm_conformance_tag]">
<sup>mm</sup>
</xsl:if>
<xsl:if test="contains(db:refsynopsisdiv/db:funcsynopsis,'geography') or contains(db:refsynopsisdiv/db:funcsynopsis/db:funcprototype/funcdef,'geography')">
<sup>G</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$sfcgal_tag and starts-with(./@conformance, '1.5')]">
<sup>cg1.5</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$geos_tag and starts-with(./@conformance, '3.9')]">
<sup>g3.9</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$geos_tag and starts-with(./@conformance, '3.10')]">
<sup>g3.10</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$geos_tag and starts-with(./@conformance, '3.11')]">
<sup>g3.11</sup>
</xsl:if>
<xsl:if test="$ref//db:para[@role=$geos_tag and starts-with(./@conformance, '3.12')]">
<sup>g3.12</sup>
</xsl:if>
<xsl:if test="$ref/descendant::*[@conformance=$Z_conformance_tag]">
<sup>3d</sup>
</xsl:if>
<!-- if only one proto just display it on first line -->
<xsl:if test="count(db:refsynopsisdiv/db:funcsynopsis/db:funcprototype) = 1">
(<xsl:call-template name="list_in_params"><xsl:with-param name="func" select="db:refsynopsisdiv/db:funcsynopsis/db:funcprototype" /></xsl:call-template>)
</xsl:if>
<xsl:if test="$output_purpose = 'true'"><xsl:value-of select="db:refnamediv/db:refpurpose" /></xsl:if>
<!-- output different proto arg combos -->
<xsl:if test="count(db:refsynopsisdiv/db:funcsynopsis/db:funcprototype) > 1">
<span class='func_args'><ol>
<xsl:for-each select="db:refsynopsisdiv/db:funcsynopsis/db:funcprototype">
<li><xsl:call-template name="list_in_params"><xsl:with-param name="func" select="." /></xsl:call-template>
<xsl:if test=".//db:paramdef[contains(db:type,' set')]"><sup> agg</sup></xsl:if>
<xsl:if test=".//db:paramdef[contains(db:type,' winset')]"> <sup>W</sup> </xsl:if></li>
</xsl:for-each>
</ol></span>
</xsl:if>
</td></tr>
</xsl:for-each>
</table><br />
<!--close section -->
</xsl:template>
<xsl:template name="examples_list">
<!--Beginning of section -->
<xsl:variable name="lt"><xsl:text><![CDATA[<]]></xsl:text></xsl:variable>
<!-- TODO: do not rely on english "Example" -->
<xsl:if test="contains(., 'Example')">
<table>
<tr>
<th colspan="2" class="example_heading">
<!-- TODO: make Examples translatable -->
<xsl:value-of select="db:title" /> Examples
</th>
</tr>
<!--only pull the first example section of each function -->
<xsl:for-each select="db:refentry//db:refsection[contains(db:title,'Example')][1]/db:programlisting[1]">
<!-- add row for each function and alternate colors of rows -->
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">evenrow</xsl:when>
<xsl:otherwise>oddrow</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<b>
<xsl:value-of select="ancestor::db:refentry/db:refnamediv/db:refname" />
</b>
<br />
<pre>
<xsl:value-of select="." disable-output-escaping="no"/>
</pre>
</td>
</tr>
</xsl:for-each>
<!--close section -->
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|