Prevent the generation of empty <itemizedlist> elements, which is invalid

docbook and causes apache fop 0.94 to choke and die.



[SVN r40047]
This commit is contained in:
Frank Mori Hess 2007-10-15 13:24:34 +00:00
parent 9b2ca02ca1
commit caeaebade4

View File

@ -59,7 +59,7 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<copyright><xsl:copy-of select="document(concat('../concepts/', @file))/copyright/node()"/></copyright> <copyright><xsl:copy-of select="document(concat('../concepts/', @file))/copyright/node()"/></copyright>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</xsl:for-each> </xsl:for-each>
</refentryinfo> </refentryinfo>
--> -->
@ -108,12 +108,12 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<!-- This part must be run even if there are no associated types to print out, so the hidden type definitions can be found --> <!-- This part must be run even if there are no associated types to print out, so the hidden type definitions can be found -->
<xsl:variable name="definition_list"> <xsl:variable name="definition_list">
<xsl:call-template name="make-definition-list"> <xsl:call-template name="make-definition-list">
<xsl:with-param name="typedefs" select="define-type | associated-type"/> <xsl:with-param name="typedefs" select="define-type | associated-type"/>
<xsl:with-param name="definition_list"> <xsl:with-param name="definition_list">
<xsl:for-each select="param/@name"> <xsl:for-each select="param/@name">
@(@<xsl:value-of select="."/>=<xsl:value-of select="."/>@)@ @(@<xsl:value-of select="."/>=<xsl:value-of select="."/>@)@
</xsl:for-each> </xsl:for-each>
</xsl:with-param> </xsl:with-param>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
@ -130,12 +130,12 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:variable name="notations"> <xsl:variable name="notations">
<xsl:for-each select="notation"> <xsl:for-each select="notation">
@@(@@<xsl:call-template name="unparse-cpp"> @@(@@<xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="*[1]"/> <xsl:with-param name="typeref" select="*[1]"/>
<xsl:with-param name="definition_list" select="$definition_list"/> <xsl:with-param name="definition_list" select="$definition_list"/>
<xsl:with-param name="ignore-cv" select="true()"/> <xsl:with-param name="ignore-cv" select="true()"/>
<xsl:with-param name="ignore-references" select="true()"/> <xsl:with-param name="ignore-references" select="true()"/>
</xsl:call-template>@@=@@<xsl:value-of select="normalize-space(@variables)"/>@@)@@ </xsl:call-template>@@=@@<xsl:value-of select="normalize-space(@variables)"/>@@)@@
</xsl:for-each> </xsl:for-each>
</xsl:variable> </xsl:variable>
@ -144,9 +144,9 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:if test="definition"> <xsl:if test="definition">
<refsect1> <refsect1>
<title>Definitions</title> <title>Definitions</title>
<xsl:for-each select="definition"> <xsl:for-each select="definition">
<p><xsl:apply-templates/></p> <p><xsl:apply-templates/></p>
</xsl:for-each> </xsl:for-each>
</refsect1> </refsect1>
</xsl:if> </xsl:if>
@ -282,53 +282,53 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
</informaltable> </informaltable>
<!-- Doug prefers the table <!-- Doug prefers the table
<variablelist> <variablelist>
<xsl:for-each select="valid-expression"> <xsl:for-each select="valid-expression">
<xsl:variable name="as-cxx-value"> <xsl:variable name="as-cxx-value">
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="*[1]"/> <xsl:with-param name="typeref" select="*[1]"/>
<xsl:with-param name="definition_list" select="$definition_list"/> <xsl:with-param name="definition_list" select="$definition_list"/>
<xsl:with-param name="notations" select="normalize-space($notations)"/> <xsl:with-param name="notations" select="normalize-space($notations)"/>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<varlistentry> <varlistentry>
<term><xsl:value-of select="@name"/>: <literal><xsl:value-of select="$as-cxx-value"/></literal></term> <term><xsl:value-of select="@name"/>: <literal><xsl:value-of select="$as-cxx-value"/></literal></term>
<listitem><variablelist> <listitem><variablelist>
<xsl:if test="return-type/*"> <xsl:if test="return-type/*">
<varlistentry><term>Return value</term><listitem><para> <varlistentry><term>Return value</term><listitem><para>
<xsl:for-each select="return-type/*"> <xsl:for-each select="return-type/*">
<xsl:if test="position()!=1 and last()!=2">, </xsl:if> <xsl:if test="position()!=1 and last()!=2">, </xsl:if>
<xsl:if test="position()=last() and last()!=1"> and </xsl:if> <xsl:if test="position()=last() and last()!=1"> and </xsl:if>
<xsl:call-template name="unparse-constraint"> <xsl:call-template name="unparse-constraint">
<xsl:with-param name="constraint" select="."/> <xsl:with-param name="constraint" select="."/>
<xsl:with-param name="definition_list" select="$definition_list"/> <xsl:with-param name="definition_list" select="$definition_list"/>
<xsl:with-param name="capitalize" select="position()=1"/> <xsl:with-param name="capitalize" select="position()=1"/>
</xsl:call-template> </xsl:call-template>
</xsl:for-each> </xsl:for-each>
</para></listitem></varlistentry> </para></listitem></varlistentry>
</xsl:if> </xsl:if>
<xsl:for-each select="precondition"> <xsl:for-each select="precondition">
<varlistentry><term>Precondition</term><listitem><para> <varlistentry><term>Precondition</term><listitem><para>
<xsl:apply-templates/> <xsl:apply-templates/>
</para></listitem></varlistentry> </para></listitem></varlistentry>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="semantics"> <xsl:for-each select="semantics">
<varlistentry><term>Semantics</term><listitem><para> <varlistentry><term>Semantics</term><listitem><para>
<xsl:apply-templates/> <xsl:apply-templates/>
</para></listitem></varlistentry> </para></listitem></varlistentry>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="postcondition"> <xsl:for-each select="postcondition">
<varlistentry><term>Postcondition</term><listitem><para> <varlistentry><term>Postcondition</term><listitem><para>
<xsl:apply-templates/> <xsl:apply-templates/>
</para></listitem></varlistentry> </para></listitem></varlistentry>
</xsl:for-each> </xsl:for-each>
</variablelist></listitem> </variablelist></listitem>
</varlistentry> </varlistentry>
</xsl:for-each> </xsl:for-each>
</variablelist> </variablelist>
--> -->
</refsect1> </refsect1>
@ -337,9 +337,9 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:if test="complexity"> <xsl:if test="complexity">
<refsect1> <refsect1>
<title>Complexity</title> <title>Complexity</title>
<xsl:for-each select="complexity"> <xsl:for-each select="complexity">
<para><xsl:apply-templates/></para> <para><xsl:apply-templates/></para>
</xsl:for-each> </xsl:for-each>
</refsect1> </refsect1>
</xsl:if> </xsl:if>
@ -347,14 +347,14 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<refsect1> <refsect1>
<title>Invariants</title> <title>Invariants</title>
<variablelist> <variablelist>
<xsl:for-each select="invariant"> <xsl:for-each select="invariant">
<varlistentry> <varlistentry>
<term><xsl:value-of select="@name"/></term> <term><xsl:value-of select="@name"/></term>
<listitem> <listitem>
<para><xsl:apply-templates/></para> <para><xsl:apply-templates/></para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</xsl:for-each> </xsl:for-each>
</variablelist> </variablelist>
</refsect1> </refsect1>
</xsl:if> </xsl:if>
@ -362,46 +362,44 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:if test="example-model"> <xsl:if test="example-model">
<refsect1> <refsect1>
<title>Models</title> <title>Models</title>
<itemizedlist> <itemizedlist>
<xsl:for-each select="example-model"> <xsl:for-each select="example-model">
<listitem> <listitem>
<simplelist type="inline"> <simplelist type="inline">
<xsl:for-each select="*"> <xsl:for-each select="*">
<xsl:variable name="example-value"> <xsl:variable name="example-value">
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="."/> <xsl:with-param name="typeref" select="."/>
<xsl:with-param name="definition_list" select="$definition_list"/> <xsl:with-param name="definition_list" select="$definition_list"/>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<member><type><xsl:value-of select="$example-value"/></type></member> <member><type><xsl:value-of select="$example-value"/></type></member>
</xsl:for-each> </xsl:for-each>
</simplelist> </simplelist>
</listitem> </listitem>
</xsl:for-each> </xsl:for-each>
</itemizedlist> </itemizedlist>
</refsect1> </refsect1>
</xsl:if> </xsl:if>
<xsl:variable name="see-also-list" select="concept-ref | see-also | refines | refines-when-mutable | models-as-first-arg | models | models-when-mutable"/> <xsl:variable name="see-also-list-0" select="concept-ref | see-also | refines | refines-when-mutable | models-as-first-arg | models | models-when-mutable"/>
<xsl:variable name="see-also-list-1" select="$see-also-list-0[string(@name | @concept) != string(../@name)]"/>
<xsl:variable name="see-also-list" select="$see-also-list-1[not(string(@name|@concept) = (preceding::*/@name | preceding::*/@concept | ancestor::*/@name | ancestor::*/@concept))]"/>
<xsl:if test="$see-also-list"> <xsl:if test="$see-also-list">
<refsect1> <refsect1>
<title>See also</title> <title>See also</title>
<itemizedlist> <itemizedlist>
<xsl:for-each select="$see-also-list"> <xsl:for-each select="$see-also-list">
<xsl:sort select="string(@name|@concept)" data-type="text"/> <xsl:sort select="string(@name|@concept)" data-type="text"/>
<xsl:if test="string(@name|@concept) != string(../@name)"> <listitem>
<xsl:if test="not(string(@name|@concept) = (preceding::*/@name | preceding::*/@concept | ancestor::*/@name | ancestor::*/@concept))"> <para>
<listitem> <xsl:call-template name="concept.link">
<para> <xsl:with-param name="name" select="@name|@concept"/>
<xsl:call-template name="concept.link"> </xsl:call-template>
<xsl:with-param name="name" select="@name|@concept"/> </para>
</xsl:call-template> </listitem>
</para> </xsl:for-each>
</listitem> </itemizedlist>
</xsl:if>
</xsl:if>
</xsl:for-each>
</itemizedlist>
</refsect1> </refsect1>
</xsl:if> </xsl:if>
@ -417,79 +415,79 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:choose> <xsl:choose>
<xsl:when test="name($constraint)='require-same-type'"> <xsl:when test="name($constraint)='require-same-type'">
<xsl:if test="$type-expr-mode">identical to </xsl:if> <xsl:if test="$type-expr-mode">identical to </xsl:if>
<type> <type>
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="$constraint/*[1]"/> <xsl:with-param name="typeref" select="$constraint/*[1]"/>
<xsl:with-param name="definition_list" select="definition_list"/> <xsl:with-param name="definition_list" select="definition_list"/>
</xsl:call-template> </xsl:call-template>
</type> </type>
</xsl:when> </xsl:when>
<xsl:when test="name($constraint)='convertible-to'"> <xsl:when test="name($constraint)='convertible-to'">
<xsl:choose> <xsl:choose>
<xsl:when test="$type-expr-mode">convertible to </xsl:when> <xsl:when test="$type-expr-mode">convertible to </xsl:when>
<xsl:when test="not($type-expr-mode) and $capitalize">Convertible to </xsl:when> <xsl:when test="not($type-expr-mode) and $capitalize">Convertible to </xsl:when>
<xsl:when test="not($type-expr-mode) and not($capitalize)">convertible to </xsl:when> <xsl:when test="not($type-expr-mode) and not($capitalize)">convertible to </xsl:when>
</xsl:choose> </xsl:choose>
<type> <type>
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="$constraint/*[1]"/> <xsl:with-param name="typeref" select="$constraint/*[1]"/>
<xsl:with-param name="definition_list" select="definition_list"/> <xsl:with-param name="definition_list" select="definition_list"/>
</xsl:call-template> </xsl:call-template>
</type> </type>
</xsl:when> </xsl:when>
<xsl:when test="name($constraint)='derived-from'"> <xsl:when test="name($constraint)='derived-from'">
<xsl:choose> <xsl:choose>
<xsl:when test="$type-expr-mode">derived from </xsl:when> <xsl:when test="$type-expr-mode">derived from </xsl:when>
<xsl:when test="not($type-expr-mode) and $capitalize">Derived from </xsl:when> <xsl:when test="not($type-expr-mode) and $capitalize">Derived from </xsl:when>
<xsl:when test="not($type-expr-mode) and not($capitalize)">derived from </xsl:when> <xsl:when test="not($type-expr-mode) and not($capitalize)">derived from </xsl:when>
</xsl:choose> </xsl:choose>
<type> <type>
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="$constraint/*[1]"/> <xsl:with-param name="typeref" select="$constraint/*[1]"/>
<xsl:with-param name="definition_list" select="definition_list"/> <xsl:with-param name="definition_list" select="definition_list"/>
</xsl:call-template> </xsl:call-template>
</type> </type>
</xsl:when> </xsl:when>
<xsl:when test="name($constraint)='assignable-to'"> <xsl:when test="name($constraint)='assignable-to'">
<xsl:choose> <xsl:choose>
<xsl:when test="$type-expr-mode">assignable to </xsl:when> <xsl:when test="$type-expr-mode">assignable to </xsl:when>
<xsl:when test="not($type-expr-mode) and $capitalize">Assignable to </xsl:when> <xsl:when test="not($type-expr-mode) and $capitalize">Assignable to </xsl:when>
<xsl:when test="not($type-expr-mode) and not($capitalize)">assignable to </xsl:when> <xsl:when test="not($type-expr-mode) and not($capitalize)">assignable to </xsl:when>
</xsl:choose> </xsl:choose>
<type> <type>
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="$constraint/*[1]"/> <xsl:with-param name="typeref" select="$constraint/*[1]"/>
<xsl:with-param name="definition_list" select="definition_list"/> <xsl:with-param name="definition_list" select="definition_list"/>
</xsl:call-template> </xsl:call-template>
</type> </type>
</xsl:when> </xsl:when>
<xsl:when test="name($constraint)='models-as-first-arg'"> <xsl:when test="name($constraint)='models-as-first-arg'">
<xsl:choose> <xsl:choose>
<xsl:when test="$type-expr-mode"> a model </xsl:when> <xsl:when test="$type-expr-mode"> a model </xsl:when>
<xsl:when test="not($type-expr-mode) and $capitalize"> Models </xsl:when> <xsl:when test="not($type-expr-mode) and $capitalize"> Models </xsl:when>
<xsl:when test="not($type-expr-mode) and not($capitalize)"> models </xsl:when> <xsl:when test="not($type-expr-mode) and not($capitalize)"> models </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:if test="$constraint/*"><xsl:comment/> <xsl:if test="$constraint/*"><xsl:comment/>
(along with <xsl:for-each select="$constraint/*"><type> (along with <xsl:for-each select="$constraint/*"><type>
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="."/> <xsl:with-param name="typeref" select="."/>
<xsl:with-param name="definition_list" select="definition_list"/> <xsl:with-param name="definition_list" select="definition_list"/>
</xsl:call-template> </xsl:call-template>
</type> </type>
<xsl:choose> <xsl:choose>
<xsl:when test="position()=last()"/> <xsl:when test="position()=last()"/>
<xsl:when test="position()=last()-1 and last()=2"> and </xsl:when> <xsl:when test="position()=last()-1 and last()=2"> and </xsl:when>
<xsl:when test="position()=last()-1 and last()!=2">, and </xsl:when> <xsl:when test="position()=last()-1 and last()!=2">, and </xsl:when>
<xsl:otherwise>, </xsl:otherwise> <xsl:otherwise>, </xsl:otherwise>
</xsl:choose><xsl:comment/> </xsl:choose><xsl:comment/>
</xsl:for-each><xsl:comment/>) <xsl:comment/> </xsl:for-each><xsl:comment/>) <xsl:comment/>
</xsl:if><xsl:comment/> </xsl:if><xsl:comment/>
<xsl:if test="$type-expr-mode"> of </xsl:if> <xsl:if test="$type-expr-mode"> of </xsl:if>
<xsl:call-template name="concept.link"> <xsl:call-template name="concept.link">
<xsl:with-param name="name" select="$constraint/@concept"/> <xsl:with-param name="name" select="$constraint/@concept"/>
</xsl:call-template> </xsl:call-template>
@ -504,35 +502,35 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:choose> <xsl:choose>
<xsl:when test="$typedefs"> <xsl:when test="$typedefs">
<xsl:variable name="type_definition"> <xsl:variable name="type_definition">
<xsl:if test="name($typedefs[1]/*[1])!='description'"> <xsl:if test="name($typedefs[1]/*[1])!='description'">
<xsl:call-template name="unparse-cpp"> <xsl:call-template name="unparse-cpp">
<xsl:with-param name="typeref" select="$typedefs[1]/*[1]"/> <xsl:with-param name="typeref" select="$typedefs[1]/*[1]"/>
<xsl:with-param name="definition_list" select="$definition_list"/> <xsl:with-param name="definition_list" select="$definition_list"/>
</xsl:call-template> </xsl:call-template>
</xsl:if> </xsl:if>
</xsl:variable> </xsl:variable>
<xsl:variable name="new_type_definition"> <xsl:variable name="new_type_definition">
<xsl:choose> <xsl:choose>
<xsl:when test="name($typedefs[1])='associated-type'"> <xsl:when test="name($typedefs[1])='associated-type'">
<xsl:value-of select="$typedefs[1]/@name"/> <xsl:value-of select="$typedefs[1]/@name"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$type_definition"/> <xsl:value-of select="$type_definition"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:call-template name="make-definition-list"> <xsl:call-template name="make-definition-list">
<xsl:with-param name="typedefs" select="$typedefs[position()!=1]"/> <xsl:with-param name="typedefs" select="$typedefs[position()!=1]"/>
<xsl:with-param name="definition_list" select="concat($definition_list, ' @(@', $typedefs[1]/@name, '=', $new_type_definition, '@)@')"/> <xsl:with-param name="definition_list" select="concat($definition_list, ' @(@', $typedefs[1]/@name, '=', $new_type_definition, '@)@')"/>
</xsl:call-template> </xsl:call-template>
</xsl:when> </xsl:when>
<xsl:otherwise> <!-- End of expression list, emit the results that have accumulated --> <xsl:otherwise> <!-- End of expression list, emit the results that have accumulated -->
<xsl:value-of select="$definition_list"/> <xsl:value-of select="$definition_list"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -600,11 +598,11 @@ Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
<xsl:if test="$list!=''"> <xsl:if test="$list!=''">
<term><varname> <term><varname>
<xsl:if test="substring-before($list,' ')=''"><xsl:value-of select="$list"/></xsl:if> <xsl:if test="substring-before($list,' ')=''"><xsl:value-of select="$list"/></xsl:if>
<xsl:value-of select="substring-before($list,' ')"/> <xsl:value-of select="substring-before($list,' ')"/>
</varname></term> </varname></term>
<xsl:call-template name="comma-list"> <xsl:call-template name="comma-list">
<xsl:with-param name="list" select="substring-after($list,' ')"/> <xsl:with-param name="list" select="substring-after($list,' ')"/>
</xsl:call-template> </xsl:call-template>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>