]> granicus.if.org Git - postgis/commitdiff
xsl that generates index listing of postgis spatial aggregates and MM compliant functions
authorRegina Obe <lr@pcorp.us>
Fri, 26 Sep 2008 18:55:43 +0000 (18:55 +0000)
committerRegina Obe <lr@pcorp.us>
Fri, 26 Sep 2008 18:55:43 +0000 (18:55 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3015 b70326c6-7e19-0410-871a-916f4a2858ee

doc/xsl/postgis_aggs_mm.xml.xsl [new file with mode: 0644]

diff --git a/doc/xsl/postgis_aggs_mm.xml.xsl b/doc/xsl/postgis_aggs_mm.xml.xsl
new file mode 100644 (file)
index 0000000..2c49a70
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\r
+<!-- ********************************************************************\r
+     $Id: 0.1 postgis_mm.xml.xsl 2008-09-26 $\r
+     ********************************************************************\r
+        Copyright 2008, Regina Obe\r
+     License: BSD\r
+        Purpose: This is an xsl transform that generates index listing of aggregate functions and mm /sql compliant functions xml section from reference_new.xml to then\r
+        be processed by doc book\r
+     ******************************************************************** -->\r
+       <xsl:output method="xml" indent="yes" />\r
+       <xsl:template match='/chapter'>\r
+       \r
+         <title>PostGIS Aggregates Index</title>\r
+         <para>The functions given below are spatial aggregate functions provided with PostGIS that can\r
+         be used just like any other sql aggregate function such as sum, average.</para>\r
+         <chapter>\r
+         <sect1><title>PostGIS Aggregate Functions</title>\r
+               \r
+               <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>\r
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment  -->\r
+               <xsl:for-each select='sect1/refentry'>\r
+                 <xsl:variable name='comment'>\r
+                       <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'&#x0d;&#x0a;', ' '), '&#09;', ' '))"/>\r
+                 </xsl:variable>\r
+\r
+<!-- For each function prototype generate the DDL comment statement\r
+       If its input is a geometry set - we know it is an aggregate function rather than a regular function -->\r
+                       <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">\r
+                               <xsl:choose>\r
+                                       <xsl:when test="contains(paramdef/type,'geometry set')">\r
+                                               <p><xref linkend="{funcdef/function}" />(geometry <xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template>) - <xsl:value-of select='$comment' /></p>\r
+                                       </xsl:when>\r
+                               </xsl:choose>\r
+                       </xsl:for-each>\r
+               </xsl:for-each>\r
+               </sect1>\r
+               \r
+               <sect1><title>PostGIS MM Compliant Functions</title>\r
+               <para>The functions given below are PostGIS functions that conform to the SQL/MM 3 standard</para>\r
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment  -->\r
+               <xsl:for-each select='sect1/refentry'>\r
+                 <xsl:variable name='comment'>\r
+                       <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'&#x0d;&#x0a;', ' '), '&#09;', ' '))"/>\r
+                 </xsl:variable>\r
+                 <xsl:variable name='refid'>\r
+                       <xsl:value-of select='@id' />\r
+                 </xsl:variable>\r
+\r
+<!-- For each function prototype generate the DDL comment statement\r
+       If its input is a geometry set - we know it is an aggregate function rather than a regular function -->\r
+                       <xsl:for-each select="refsection">\r
+                               <xsl:for-each select="para">\r
+                                       <xsl:choose>\r
+                                               <xsl:when test="contains(.,'implements the SQL/MM')">\r
+                                                       <p><xref linkend="{$refid}" /> - <xsl:value-of select='$comment' /></p>\r
+                                               </xsl:when>\r
+                                       </xsl:choose>\r
+                               </xsl:for-each>\r
+                       </xsl:for-each>\r
+               </xsl:for-each>\r
+               </sect1>\r
+               </chapter>\r
+       </xsl:template>\r
+\r
+       <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->\r
+       <xsl:template name="listparams">\r
+               <xsl:param name="func" />\r
+               <xsl:for-each select="$func">\r
+                       <xsl:if test="count(paramdef/parameter) &gt; 0">args: </xsl:if>\r
+                       <xsl:for-each select="paramdef">\r
+                               <xsl:choose>\r
+                                       <xsl:when test="count(parameter) &gt; 0"> \r
+                                               <xsl:value-of select="parameter" />\r
+                                       </xsl:when>\r
+                               </xsl:choose>\r
+                               <xsl:if test="position()&lt;last()"><xsl:text>, </xsl:text></xsl:if>\r
+                       </xsl:for-each>\r
+                       <xsl:if test="count(paramdef/parameter) &gt; 0"> - </xsl:if>\r
+               </xsl:for-each> \r
+       </xsl:template>\r
+\r
+</xsl:stylesheet>\r