mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-23 16:42:35 +00:00
#2753 fix xsl to not trap intro
git-svn-id: http://svn.osgeo.org/postgis/trunk@12628 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
87924dc4c9
commit
f8ea325708
|
@ -7,11 +7,12 @@
|
|||
For robustness, geometry coordinates have an exact rational number representation.
|
||||
</para>
|
||||
<para>
|
||||
Installation instructions of the library can be found on SFCGAL home page (http://www.sfcgal.org).
|
||||
Installation instructions of the library can be found on SFCGAL home page <ulink url="http://www.sfcgal.org">http://www.sfcgal.org</ulink>.
|
||||
To load the functions execute postgis/sfcgal.sql
|
||||
</para>
|
||||
</abstract>
|
||||
</sect1info>
|
||||
<title>SFCGAL Functions</title>
|
||||
<refentry id="postgis_sfcgal_version">
|
||||
<refnamediv>
|
||||
<refname>postgis_sfcgal_version</refname>
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<!-- ********************************************************************
|
||||
$Id: raster_comments.sql.xsl 9237 2012-02-20 13:16:05Z strk $
|
||||
$Id: tiger_geocoder_comments.sql.xsl 7636 2011-07-14 11:32:45Z robe $
|
||||
********************************************************************
|
||||
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
|
||||
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/sect1[@id='reference_sfcgal']" />
|
||||
<xsl:apply-templates select="/book/chapter[@id='reference']" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="refentry">
|
||||
<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:variable name='plaincomment'>
|
||||
<xsl:value-of select="normalize-space(translate(translate(refnamediv/refpurpose,'
', ' '), '	', ' '))"/>
|
||||
</xsl:variable>
|
||||
<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">
|
||||
|
@ -30,12 +31,13 @@
|
|||
</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.
|
||||
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>
|
||||
|
||||
|
@ -64,34 +66,16 @@ COMMENT ON <xsl:choose><xsl:when test="contains(paramdef/type,'geometry set')">A
|
|||
</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 -->
|
||||
<!--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: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>
|
||||
|
|
Loading…
Reference in a new issue