doc/xsl: rearrange member doc generation

Creating an empty <variablelist> is illegal. This can already be seen in
the XSL anywhere it is generated. The used XSL programming pattern
requires the look-up conditions to be repeated between the <xsl:if> and
<xsl:apply-templates> tags. Usually this is not a problem, but the
conditions for memberdef is too much to copy around.

The conditions between the if and the apply-templates have already
diverged, causing validation errors (that are currently suppressed).

Rearrange the XSL so that the applicable memberdef are stored in a
variable, so that both the if and the apply-templates operate on the
exact same set of matches. This avoids emitting empty <variablelist>.

As a result, the members of structures wl_argument, wl_interface,
wl_message, and wl_listener newly appear in the documentation.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
This commit is contained in:
Pekka Paalanen 2025-12-28 12:36:40 +02:00
parent 12ec67aed5
commit 4216a08b96

View file

@ -9,9 +9,7 @@
<section id="{$which}-Functions"> <section id="{$which}-Functions">
<title>Functions</title> <title>Functions</title>
<para /> <para />
<variablelist> <xsl:apply-templates select="/doxygen/compounddef[@kind='file']/sectiondef" />
<xsl:apply-templates select="/doxygen/compounddef[@kind='file']/sectiondef/memberdef" />
</variablelist>
</section> </section>
</xsl:template> </xsl:template>
@ -99,9 +97,10 @@
<xsl:apply-templates select="para" /> <xsl:apply-templates select="para" />
</xsl:template> </xsl:template>
<!-- methods --> <xsl:template match="sectiondef">
<xsl:template match="memberdef" > <xsl:variable name="docitems"
<xsl:if test="(@kind = 'function' and select="memberdef[
(@kind = 'function' and
(@static = 'no' or (@static = 'no' or
substring(location/@bodyfile, substring(location/@bodyfile,
string-length(location/@bodyfile) - 1, string-length(location/@bodyfile) - 1,
@ -110,7 +109,18 @@
and @prot = 'public' and @prot = 'public'
) )
or or
(@kind != 'function' and normalize-space(briefdescription) != '')"> (@kind != 'function' and normalize-space(briefdescription) != '')
]" />
<xsl:if test="$docitems">
<variablelist>
<!-- Apply memberdef template -->
<xsl:apply-templates select="$docitems" />
</variablelist>
</xsl:if>
</xsl:template>
<!-- methods -->
<xsl:template match="memberdef" >
<varlistentry id="{$which}-{@id}"> <varlistentry id="{$which}-{@id}">
<term> <term>
<xsl:value-of select="name"/> <xsl:value-of select="name"/>
@ -125,7 +135,6 @@
<xsl:apply-templates select="detaileddescription" /> <xsl:apply-templates select="detaileddescription" />
</listitem> </listitem>
</varlistentry> </varlistentry>
</xsl:if>
</xsl:template> </xsl:template>
<!-- classes --> <!-- classes -->
@ -145,11 +154,7 @@
<para /> <para />
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="sectiondef/memberdef[@kind='function' and @static='no']"> <xsl:apply-templates select="sectiondef" />
<variablelist>
<xsl:apply-templates select="sectiondef/memberdef" />
</variablelist>
</xsl:if>
</section> </section>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>