[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-1168-gd59c3c547
git at osgeo.org
git at osgeo.org
Thu Jul 6 07:53:26 PDT 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via d59c3c547b1eb074741fdd2af69c4388dfacb220 (commit)
from 5b710eed2289d54af09b918343a4585d3ba7f18a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d59c3c547b1eb074741fdd2af69c4388dfacb220
Author: Sandro Santilli <strk at kbt.io>
Date: Thu Jul 6 16:52:32 2023 +0200
Move the common globalReplace template in a common file
This is a first step toward cleanup of xsl, more common
templates could be put in common files to include (I'm thinking
mostly cheatsheets)
diff --git a/doc/xsl/common_utils.xsl b/doc/xsl/common_utils.xsl
new file mode 100644
index 000000000..03b4e5146
--- /dev/null
+++ b/doc/xsl/common_utils.xsl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
+ Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
+<xsl:template name="globalReplace">
+ <xsl:param name="outputString"/>
+ <xsl:param name="target"/>
+ <xsl:param name="replacement"/>
+ <xsl:choose>
+ <xsl:when test="contains($outputString,$target)">
+ <xsl:value-of select=
+ "concat(substring-before($outputString,$target),
+ $replacement)"/>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString"
+ select="substring-after($outputString,$target)"/>
+ <xsl:with-param name="target" select="$target"/>
+ <xsl:with-param name="replacement"
+ select="$replacement"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$outputString"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/doc/xsl/post_gis_day_cards.html.xsl b/doc/xsl/post_gis_day_cards.html.xsl
index 289219d21..27422d7e4 100644
--- a/doc/xsl/post_gis_day_cards.html.xsl
+++ b/doc/xsl/post_gis_day_cards.html.xsl
@@ -6,6 +6,7 @@
License: BSD
Purpose: This is an xsl transform that generates PostGIS flash cards
******************************************************************** -->
+ <xsl:include href="common_utils.xsl" />
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -110,31 +111,6 @@ h1 {
<div class="card_separator"> </div>]]>
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
diff --git a/doc/xsl/postgis_cheatsheet.html.xsl b/doc/xsl/postgis_cheatsheet.html.xsl
index d2ba4c239..2847a04bb 100644
--- a/doc/xsl/postgis_cheatsheet.html.xsl
+++ b/doc/xsl/postgis_cheatsheet.html.xsl
@@ -7,6 +7,9 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -223,30 +226,6 @@ code {font-size: 8pt}
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
<xsl:template name="break">
<xsl:param name="text" select="."/>
diff --git a/doc/xsl/postgis_comments.sql.xsl b/doc/xsl/postgis_comments.sql.xsl
index 56ca5eb1c..a07319475 100644
--- a/doc/xsl/postgis_comments.sql.xsl
+++ b/doc/xsl/postgis_comments.sql.xsl
@@ -7,6 +7,8 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<!-- We deal only with the reference chapter -->
@@ -48,31 +50,6 @@ COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,' set')">AGGREGATE
</xsl:for-each>
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function. -->
<xsl:template name="listparams">
<xsl:param name="func" />
diff --git a/doc/xsl/raster_cheatsheet.html.xsl b/doc/xsl/raster_cheatsheet.html.xsl
index f5f260f1d..84855c42c 100644
--- a/doc/xsl/raster_cheatsheet.html.xsl
+++ b/doc/xsl/raster_cheatsheet.html.xsl
@@ -7,6 +7,9 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -195,31 +198,6 @@ code {font-size: 8pt}
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
diff --git a/doc/xsl/raster_comments.sql.xsl b/doc/xsl/raster_comments.sql.xsl
index bf9753e2d..9980cb88c 100644
--- a/doc/xsl/raster_comments.sql.xsl
+++ b/doc/xsl/raster_comments.sql.xsl
@@ -1,124 +1,102 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- ********************************************************************
- ********************************************************************
- Copyright 2008, Regina Obe
- License: BSD
- Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
- statements from postgis xml doc reference for WKT Raster section
- ******************************************************************** -->
- <xsl:output method="text" />
-
- <!-- We deal only with the reference chapter -->
- <xsl:template match="/">
- <xsl:apply-templates select="/book/chapter[@id='RT_reference']" />
- <xsl:apply-templates select="/book/chapter[@id='RT_reference']/sect1[contains(@id, 'Type')]" />
- </xsl:template>
-
- <xsl:template match="chapter">
- <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
-<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
- <xsl:for-each select="sect1[not(contains(@id,'Operator'))]/refentry">
- <xsl:variable name='plaincomment'>
- <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
- </xsl:variable>
-<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
- <xsl:variable name='comment'>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString" select="$plaincomment"/>
- <xsl:with-param name="target" select="$ap"/>
- <xsl:with-param name="replacement" select="''"/>
- </xsl:call-template>
- </xsl:variable>
-<!-- For each function prototype generate the DDL comment statement
- If its input is a geometry set - we know it is an aggregate function rather than a regular function.
- Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
- <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
-COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set') or contains(paramdef/type,'raster set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
-<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:when test="contains(type,'raster set')">raster</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
-</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
- </xsl:for-each>
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="sect1[contains(@id, 'Type')]">
- <xsl:for-each select="refentry">
- <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
- <!-- If this is a raster type grab the ref entry summary and refname to make type comment -->
-
- <xsl:variable name='plaincomment'>
- <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
- </xsl:variable>
- <!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
- <xsl:variable name='comment'>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString" select="$plaincomment"/>
- <xsl:with-param name="target" select="$ap"/>
- <xsl:with-param name="replacement" select="''"/>
- </xsl:call-template>
- </xsl:variable>
- COMMENT ON TYPE <xsl:value-of select="refnamediv/refname" /> IS 'postgis raster type: <xsl:value-of select='$comment' />';
-
- </xsl:for-each>
- </xsl:template>
-
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="escapesinglequotes">
- <xsl:param name="arg1"/>
- <xsl:variable name="apostrophe">'</xsl:variable>
- <xsl:choose>
- <!-- this string has at least on single quote -->
- <xsl:when test="contains($arg1, $apostrophe)">
- <xsl:if test="string-length(normalize-space(substring-before($arg1, $apostrophe))) > 0"><xsl:value-of select="substring-before($arg1, $apostrophe)" disable-output-escaping="yes"/>''</xsl:if>
- <xsl:call-template name="escapesinglequotes">
- <xsl:with-param name="arg1"><xsl:value-of select="substring-after($arg1, $apostrophe)" disable-output-escaping="yes"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- no quotes found in string, just print it -->
- <xsl:when test="string-length(normalize-space($arg1)) > 0"><xsl:value-of select="normalize-space($arg1)"/></xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->
- <xsl:template name="listparams">
- <xsl:param name="func" />
- <xsl:for-each select="$func">
- <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
- <xsl:for-each select="paramdef">
- <xsl:choose>
- <xsl:when test="count(parameter) > 0">
- <xsl:call-template name="escapesinglequotes">
- <xsl:with-param name="arg1" select="parameter"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
- </xsl:for-each>
- <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- ********************************************************************
+ ********************************************************************
+ Copyright 2008, Regina Obe
+ License: BSD
+ Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
+ statements from postgis xml doc reference for WKT Raster section
+ ******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
+ <xsl:output method="text" />
+
+ <!-- We deal only with the reference chapter -->
+ <xsl:template match="/">
+ <xsl:apply-templates select="/book/chapter[@id='RT_reference']" />
+ <xsl:apply-templates select="/book/chapter[@id='RT_reference']/sect1[contains(@id, 'Type')]" />
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
+ <xsl:for-each select="sect1[not(contains(@id,'Operator'))]/refentry">
+ <xsl:variable name='plaincomment'>
+ <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
+ </xsl:variable>
+<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
+ <xsl:variable name='comment'>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString" select="$plaincomment"/>
+ <xsl:with-param name="target" select="$ap"/>
+ <xsl:with-param name="replacement" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+<!-- For each function prototype generate the DDL comment statement
+ If its input is a geometry set - we know it is an aggregate function rather than a regular function.
+ Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
+ <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
+COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set') or contains(paramdef/type,'raster set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
+<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:when test="contains(type,'raster set')">raster</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
+</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="sect1[contains(@id, 'Type')]">
+ <xsl:for-each select="refentry">
+ <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
+ <!-- If this is a raster type grab the ref entry summary and refname to make type comment -->
+
+ <xsl:variable name='plaincomment'>
+ <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
+ </xsl:variable>
+ <!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
+ <xsl:variable name='comment'>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString" select="$plaincomment"/>
+ <xsl:with-param name="target" select="$ap"/>
+ <xsl:with-param name="replacement" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ COMMENT ON TYPE <xsl:value-of select="refnamediv/refname" /> IS 'postgis raster type: <xsl:value-of select='$comment' />';
+
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="escapesinglequotes">
+ <xsl:param name="arg1"/>
+ <xsl:variable name="apostrophe">'</xsl:variable>
+ <xsl:choose>
+ <!-- this string has at least on single quote -->
+ <xsl:when test="contains($arg1, $apostrophe)">
+ <xsl:if test="string-length(normalize-space(substring-before($arg1, $apostrophe))) > 0"><xsl:value-of select="substring-before($arg1, $apostrophe)" disable-output-escaping="yes"/>''</xsl:if>
+ <xsl:call-template name="escapesinglequotes">
+ <xsl:with-param name="arg1"><xsl:value-of select="substring-after($arg1, $apostrophe)" disable-output-escaping="yes"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- no quotes found in string, just print it -->
+ <xsl:when test="string-length(normalize-space($arg1)) > 0"><xsl:value-of select="normalize-space($arg1)"/></xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->
+ <xsl:template name="listparams">
+ <xsl:param name="func" />
+ <xsl:for-each select="$func">
+ <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
+ <xsl:for-each select="paramdef">
+ <xsl:choose>
+ <xsl:when test="count(parameter) > 0">
+ <xsl:call-template name="escapesinglequotes">
+ <xsl:with-param name="arg1" select="parameter"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
+ </xsl:for-each>
+ <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/doc/xsl/sfcgal_cheatsheet.html.xsl b/doc/xsl/sfcgal_cheatsheet.html.xsl
index 4db22cadb..f29b3674f 100644
--- a/doc/xsl/sfcgal_cheatsheet.html.xsl
+++ b/doc/xsl/sfcgal_cheatsheet.html.xsl
@@ -7,6 +7,9 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -172,31 +175,6 @@ h1 {
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
diff --git a/doc/xsl/sfcgal_comments.sql.xsl b/doc/xsl/sfcgal_comments.sql.xsl
index e08342cd6..db0046a47 100644
--- a/doc/xsl/sfcgal_comments.sql.xsl
+++ b/doc/xsl/sfcgal_comments.sql.xsl
@@ -1,85 +1,63 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- ********************************************************************
- ********************************************************************
- Copyright 2008, Regina Obe
- License: BSD
- Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
- statements from postgis xml doc reference
- ******************************************************************** -->
- <xsl:output method="text" />
-
- <!-- We deal only with the reference chapter -->
- <xsl:template match="/">
- <xsl:apply-templates select="/book/chapter[@id='reference']" />
- </xsl:template>
-
- <xsl:template match="chapter">
- <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
-<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
- <xsl:for-each select="sect1[@id='reference_sfcgal']/refentry">
- <xsl:variable name='plaincomment'>
- <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
- </xsl:variable>
-<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
- <xsl:variable name='comment'>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString" select="$plaincomment"/>
- <xsl:with-param name="target" select="$ap"/>
- <xsl:with-param name="replacement" select="''"/>
- </xsl:call-template>
- </xsl:variable>
-<!-- For each function prototype generate the DDL comment statement
- If its input is a geometry set - we know it is an aggregate function rather than a regular function
- Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
- <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
-COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
-<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
-</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
- </xsl:for-each>
- </xsl:for-each>
- </xsl:template>
-
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function. -->
- <xsl:template name="listparams">
- <xsl:param name="func" />
- <xsl:for-each select="$func">
- <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
- <xsl:for-each select="paramdef">
- <xsl:choose>
- <xsl:when test="count(parameter) > 0">
- <xsl:value-of select="parameter" />
- </xsl:when>
- </xsl:choose>
- <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
- </xsl:for-each>
- <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- ********************************************************************
+ ********************************************************************
+ Copyright 2008, Regina Obe
+ License: BSD
+ Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
+ statements from postgis xml doc reference
+ ******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
+ <xsl:output method="text" />
+
+ <!-- We deal only with the reference chapter -->
+ <xsl:template match="/">
+ <xsl:apply-templates select="/book/chapter[@id='reference']" />
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
+ <xsl:for-each select="sect1[@id='reference_sfcgal']/refentry">
+ <xsl:variable name='plaincomment'>
+ <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
+ </xsl:variable>
+<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
+ <xsl:variable name='comment'>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString" select="$plaincomment"/>
+ <xsl:with-param name="target" select="$ap"/>
+ <xsl:with-param name="replacement" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+<!-- For each function prototype generate the DDL comment statement
+ If its input is a geometry set - we know it is an aggregate function rather than a regular function
+ Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
+ <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
+COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
+<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
+</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function. -->
+ <xsl:template name="listparams">
+ <xsl:param name="func" />
+ <xsl:for-each select="$func">
+ <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
+ <xsl:for-each select="paramdef">
+ <xsl:choose>
+ <xsl:when test="count(parameter) > 0">
+ <xsl:value-of select="parameter" />
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
+ </xsl:for-each>
+ <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/doc/xsl/tiger_geocoder_cheatsheet.html.xsl b/doc/xsl/tiger_geocoder_cheatsheet.html.xsl
index 5e89afa95..29f7cd3e7 100644
--- a/doc/xsl/tiger_geocoder_cheatsheet.html.xsl
+++ b/doc/xsl/tiger_geocoder_cheatsheet.html.xsl
@@ -7,6 +7,9 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -170,31 +173,6 @@ h1 {
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
diff --git a/doc/xsl/tiger_geocoder_comments.sql.xsl b/doc/xsl/tiger_geocoder_comments.sql.xsl
index d48d624a5..39468a0af 100644
--- a/doc/xsl/tiger_geocoder_comments.sql.xsl
+++ b/doc/xsl/tiger_geocoder_comments.sql.xsl
@@ -1,85 +1,63 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- ********************************************************************
- ********************************************************************
- Copyright 2008, Regina Obe
- License: BSD
- Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
- statements from postgis xml doc reference
- ******************************************************************** -->
- <xsl:output method="text" />
-
- <!-- We deal only with the reference chapter -->
- <xsl:template match="/">
- <xsl:apply-templates select="/book/chapter[@id='Extras']" />
- </xsl:template>
-
- <xsl:template match="chapter">
- <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
-<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
- <xsl:for-each select="sect1[@id='Tiger_Geocoder']/refentry">
- <xsl:variable name='plaincomment'>
- <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
- </xsl:variable>
-<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
- <xsl:variable name='comment'>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString" select="$plaincomment"/>
- <xsl:with-param name="target" select="$ap"/>
- <xsl:with-param name="replacement" select="''"/>
- </xsl:call-template>
- </xsl:variable>
-<!-- For each function prototype generate the DDL comment statement
- If its input is a geometry set - we know it is an aggregate function rather than a regular function
- Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
- <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
-COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
-<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
-</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
- </xsl:for-each>
- </xsl:for-each>
- </xsl:template>
-
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function. -->
- <xsl:template name="listparams">
- <xsl:param name="func" />
- <xsl:for-each select="$func">
- <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
- <xsl:for-each select="paramdef">
- <xsl:choose>
- <xsl:when test="count(parameter) > 0">
- <xsl:value-of select="parameter" />
- </xsl:when>
- </xsl:choose>
- <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
- </xsl:for-each>
- <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- ********************************************************************
+ ********************************************************************
+ Copyright 2008, Regina Obe
+ License: BSD
+ Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
+ statements from postgis xml doc reference
+ ******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
+ <xsl:output method="text" />
+
+ <!-- We deal only with the reference chapter -->
+ <xsl:template match="/">
+ <xsl:apply-templates select="/book/chapter[@id='Extras']" />
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
+ <xsl:for-each select="sect1[@id='Tiger_Geocoder']/refentry">
+ <xsl:variable name='plaincomment'>
+ <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
+ </xsl:variable>
+<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
+ <xsl:variable name='comment'>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString" select="$plaincomment"/>
+ <xsl:with-param name="target" select="$ap"/>
+ <xsl:with-param name="replacement" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+<!-- For each function prototype generate the DDL comment statement
+ If its input is a geometry set - we know it is an aggregate function rather than a regular function
+ Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
+ <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
+COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text> </xsl:text> <xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
+<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'geometry set')">geometry</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
+</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function. -->
+ <xsl:template name="listparams">
+ <xsl:param name="func" />
+ <xsl:for-each select="$func">
+ <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
+ <xsl:for-each select="paramdef">
+ <xsl:choose>
+ <xsl:when test="count(parameter) > 0">
+ <xsl:value-of select="parameter" />
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
+ </xsl:for-each>
+ <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/doc/xsl/topology_cheatsheet.html.xsl b/doc/xsl/topology_cheatsheet.html.xsl
index b6a9c5abd..adf5eb36a 100644
--- a/doc/xsl/topology_cheatsheet.html.xsl
+++ b/doc/xsl/topology_cheatsheet.html.xsl
@@ -7,6 +7,9 @@
Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
statements from postgis xml doc reference
******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
<xsl:output method="text" />
<xsl:variable name='new_tag'>Availability: <xsl:value-of select="$postgis_version" /></xsl:variable>
<xsl:variable name='enhanced_tag'>Enhanced: <xsl:value-of select="$postgis_version" /></xsl:variable>
@@ -176,31 +179,6 @@ h1 {
</xsl:template>
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
diff --git a/doc/xsl/topology_comments.sql.xsl b/doc/xsl/topology_comments.sql.xsl
index d89fbc273..4c3092fb6 100644
--- a/doc/xsl/topology_comments.sql.xsl
+++ b/doc/xsl/topology_comments.sql.xsl
@@ -1,94 +1,72 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- ********************************************************************
- ********************************************************************
- Copyright 2008, Regina Obe
- License: BSD
- Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
- statements from postgis xml doc reference
- ******************************************************************** -->
- <xsl:output method="text" />
-
- <!-- We deal only with the reference chapter -->
- <xsl:template match="/">
- <xsl:apply-templates select="/book/chapter[@id='Topology']" />
- </xsl:template>
-
- <xsl:template match="chapter">
- <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
-<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
- <xsl:for-each select="sect1[not(contains(@id,'Operator'))]/refentry">
- <xsl:variable name='plaincomment'>
- <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
- </xsl:variable>
-<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
- <xsl:variable name='comment'>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString" select="$plaincomment"/>
- <xsl:with-param name="target" select="$ap"/>
- <xsl:with-param name="replacement" select="''"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
-<!-- If this is a postgis type grab the ref entry summary and refname to make type comment -->
-<xsl:when test="parent::sect1[contains(@id,'Types')]">
-COMMENT ON TYPE topology.<xsl:value-of select="refnamediv/refname" /> IS 'postgis type: <xsl:value-of select='$comment' />';
-</xsl:when>
-<xsl:when test="parent::sect1[contains(@id,'Domain')]">
-COMMENT ON DOMAIN topology.<xsl:value-of select="refnamediv/refname" /> IS 'postgis domain: <xsl:value-of select='$comment' />';
-</xsl:when>
- </xsl:choose>
-<!-- For each function prototype generate the DDL comment statement
- If its input is a geometry set - we know it is an aggregate function rather than a regular function
- Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
- <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
-COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,' set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text></xsl:text> topology.<xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
-<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'topoelement set')">topoelement</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
-</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
- </xsl:for-each>
- </xsl:for-each>
- </xsl:template>
-
-<!--General replace macro hack to make up for the fact xsl 1.0 does not have a built in one.
- Not needed for xsl 2.0 lifted from http://www.xml.com/pub/a/2002/06/05/transforming.html -->
- <xsl:template name="globalReplace">
- <xsl:param name="outputString"/>
- <xsl:param name="target"/>
- <xsl:param name="replacement"/>
- <xsl:choose>
- <xsl:when test="contains($outputString,$target)">
- <xsl:value-of select=
- "concat(substring-before($outputString,$target),
- $replacement)"/>
- <xsl:call-template name="globalReplace">
- <xsl:with-param name="outputString"
- select="substring-after($outputString,$target)"/>
- <xsl:with-param name="target" select="$target"/>
- <xsl:with-param name="replacement"
- select="$replacement"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->
- <xsl:template name="listparams">
- <xsl:param name="func" />
- <xsl:for-each select="$func">
- <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
- <xsl:for-each select="paramdef">
- <xsl:choose>
- <xsl:when test="count(parameter) > 0">
- <xsl:value-of select="parameter" />
- </xsl:when>
- </xsl:choose>
- <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
- </xsl:for-each>
- <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- ********************************************************************
+ ********************************************************************
+ Copyright 2008, Regina Obe
+ License: BSD
+ Purpose: This is an xsl transform that generates PostgreSQL COMMENT ON FUNCTION ddl
+ statements from postgis xml doc reference
+ ******************************************************************** -->
+
+ <xsl:include href="common_utils.xsl" />
+
+ <xsl:output method="text" />
+
+ <!-- We deal only with the reference chapter -->
+ <xsl:template match="/">
+ <xsl:apply-templates select="/book/chapter[@id='Topology']" />
+ </xsl:template>
+
+ <xsl:template match="chapter">
+ <xsl:variable name="ap"><xsl:text>'</xsl:text></xsl:variable>
+<!-- Pull out the purpose section for each ref entry and strip whitespace and put in a variable to be tagged unto each function comment -->
+ <xsl:for-each select="sect1[not(contains(@id,'Operator'))]/refentry">
+ <xsl:variable name='plaincomment'>
+ <xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), ' ', ' '))"/>
+ </xsl:variable>
+<!-- Replace apostrophes with 2 apostrophes needed for escaping in SQL -->
+ <xsl:variable name='comment'>
+ <xsl:call-template name="globalReplace">
+ <xsl:with-param name="outputString" select="$plaincomment"/>
+ <xsl:with-param name="target" select="$ap"/>
+ <xsl:with-param name="replacement" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+<!-- If this is a postgis type grab the ref entry summary and refname to make type comment -->
+<xsl:when test="parent::sect1[contains(@id,'Types')]">
+COMMENT ON TYPE topology.<xsl:value-of select="refnamediv/refname" /> IS 'postgis type: <xsl:value-of select='$comment' />';
+</xsl:when>
+<xsl:when test="parent::sect1[contains(@id,'Domain')]">
+COMMENT ON DOMAIN topology.<xsl:value-of select="refnamediv/refname" /> IS 'postgis domain: <xsl:value-of select='$comment' />';
+</xsl:when>
+ </xsl:choose>
+<!-- For each function prototype generate the DDL comment statement
+ If its input is a geometry set - we know it is an aggregate function rather than a regular function
+ Do not output OUT params since they define output rather than act as input and do not put a comma after argument just before an OUT parameter -->
+ <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">
+COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,' set')">AGGREGATE</xsl:when><xsl:otherwise>FUNCTION</xsl:otherwise></xsl:choose><xsl:text></xsl:text> topology.<xsl:value-of select="funcdef/function" />(<xsl:for-each select="paramdef"><xsl:choose><xsl:when test="count(parameter) > 0">
+<xsl:choose><xsl:when test="contains(parameter,'OUT')"></xsl:when><xsl:when test="contains(type,'topoelement set')">topoelement</xsl:when><xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise></xsl:choose><xsl:if test="position()<last() and not(contains(parameter,'OUT')) and not(contains(following-sibling::paramdef[1],'OUT'))"><xsl:text>, </xsl:text></xsl:if></xsl:when>
+</xsl:choose></xsl:for-each>) IS '<xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template> <xsl:value-of select='$comment' />';
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->
+ <xsl:template name="listparams">
+ <xsl:param name="func" />
+ <xsl:for-each select="$func">
+ <xsl:if test="count(paramdef/parameter) > 0">args: </xsl:if>
+ <xsl:for-each select="paramdef">
+ <xsl:choose>
+ <xsl:when test="count(parameter) > 0">
+ <xsl:value-of select="parameter" />
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="position()<last()"><xsl:text>, </xsl:text></xsl:if>
+ </xsl:for-each>
+ <xsl:if test="count(paramdef/parameter) > 0"> - </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
-----------------------------------------------------------------------
Summary of changes:
doc/xsl/common_utils.xsl | 29 ++++
doc/xsl/post_gis_day_cards.html.xsl | 26 +---
doc/xsl/postgis_cheatsheet.html.xsl | 27 +---
doc/xsl/postgis_comments.sql.xsl | 27 +---
doc/xsl/raster_cheatsheet.html.xsl | 28 +---
doc/xsl/raster_comments.sql.xsl | 226 +++++++++++++----------------
doc/xsl/sfcgal_cheatsheet.html.xsl | 28 +---
doc/xsl/sfcgal_comments.sql.xsl | 148 ++++++++-----------
doc/xsl/tiger_geocoder_cheatsheet.html.xsl | 28 +---
doc/xsl/tiger_geocoder_comments.sql.xsl | 148 ++++++++-----------
doc/xsl/topology_cheatsheet.html.xsl | 28 +---
doc/xsl/topology_comments.sql.xsl | 166 +++++++++------------
12 files changed, 347 insertions(+), 562 deletions(-)
create mode 100644 doc/xsl/common_utils.xsl
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list