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
|
<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"
>
<!-- ********************************************************************
********************************************************************
Copyright 2010-2022, Regina Obe
License: BSD-3-Clause
Purpose: This is an xsl transform that generates file list_new_functions.xml which
includes what is new in each release
It uses xml reference sections from reference.xml to then be processed by docbook
******************************************************************** -->
<xsl:output method="xml" indent="yes" encoding="utf-8" />
<!-- We deal only with the reference chapters -->
<xsl:template match="/">
<xsl:apply-templates select="/db:book/db:chapter[contains(@xml:id, 'reference')]" />
</xsl:template>
<xsl:template match="/">
<xsl:variable name="chap" select="." />
<!-- for each postgis-version { -->
<xsl:for-each select="document('xsl-config.xml')//list_new_functions/postgis_versions/*">
<xsl:variable name='ver'>
<xsl:value-of select="." />
</xsl:variable>
<xsl:variable name='ver_id'>
<xsl:value-of select="translate($ver,'.','_')" />
</xsl:variable>
<section>
<xsl:variable name="header" select="document('xsl-config.xml')//list_new_functions/per_version_header" />
<title>
<xsl:value-of select="substring-before($header/title, '%')" />
<xsl:value-of select="$ver" />
<xsl:value-of select="substring-after($header/title, '%')" />
</title>
<para>
<xsl:value-of select="$header/para" />
</para>
<!-- for each supported-tag { -->
<xsl:for-each select="document('xsl-config.xml')//list_new_functions/supported_tags/*">
<xsl:variable name='tag_node' select="." />
<xsl:variable name='tag_para' select="string($tag_node/para)" />
<xsl:variable name='tag_role' select="$tag_node/@role" />
<!-- { -->
<xsl:if test="$chap//db:para[@role=$tag_role and starts-with(./@conformance, $ver)]">
<para>
<xsl:value-of select="substring-before($tag_para, '%')" />
<xsl:value-of select="$ver" />
<xsl:value-of select="substring-after($tag_para, '%')" />
</para>
<itemizedlist>
<!-- 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="$chap//db:refentry">
<xsl:sort select="db:refnamediv/db:refname"/>
<xsl:variable name='comment'>
<xsl:value-of select="normalize-space(translate(translate(db:refnamediv/db:refpurpose,'
', ' '), '	', ' '))"/>
</xsl:variable>
<xsl:variable name="refid">
<xsl:value-of select="@xml:id" />
</xsl:variable>
<xsl:variable name="refname">
<xsl:value-of select="db:refnamediv/db:refname" />
</xsl:variable>
<!-- For each section if there is note about availability in this version -->
<xsl:for-each select="db:refsection">
<xsl:for-each select=".//db:para[@role=$tag_role and starts-with(./@conformance, $ver)]">
<listitem>
<simpara>
<link linkend="{$refid}"><xsl:value-of select="$refname" /></link> - <xsl:value-of select="." /><xsl:text> </xsl:text> <xsl:value-of select="$comment" />
</simpara>
</listitem>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</itemizedlist>
</xsl:if>
<!-- } -->
</xsl:for-each>
<!-- each supporte-tag } -->
</section>
</xsl:for-each>
<!-- each postgis-version } -->
</xsl:template>
</xsl:stylesheet>
|