Imported Upstream version 2.8.0
[platform/upstream/libxml2.git] / doc / checkapisym.xsl
1 <?xml version="1.0"?>
2 <!-- This stylesheet is used to check that symbols exported
3      from libxml2-api.xml are also present in the symbol file
4      symbols.xml which is used to generate libxml2.syms setting
5      up the allowed access point to the shared libraries -->
6
7
8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9                 version="1.0">
10   <xsl:output method="text" encoding="UTF-8"/>
11
12   <xsl:variable name="syms" select="document('symbols.xml')"/>
13
14   <xsl:template match="/">
15     <xsl:message terminate="no">
16       <xsl:text>Looking for functions in symbols.xml</xsl:text>
17     </xsl:message>
18     <xsl:apply-templates select="/api/symbols/function"/>
19     <xsl:message terminate="no">
20       <xsl:text>Found </xsl:text>
21       <xsl:value-of select="count(/api/symbols/function)"/>
22       <xsl:text> functions</xsl:text>
23     </xsl:message>
24     <xsl:message terminate="no">
25       <xsl:text>Looking for variables in symbols.xml</xsl:text>
26     </xsl:message>
27     <xsl:apply-templates select="/api/symbols/variable"/>
28     <xsl:message terminate="no">
29       <xsl:text>Found </xsl:text>
30       <xsl:value-of select="count(/api/symbols/variable)"/>
31       <xsl:text> variables</xsl:text>
32     </xsl:message>
33   </xsl:template>
34
35   <xsl:template match="function|variable">
36     <xsl:variable name="name" select="@name"/>
37     <xsl:variable name="symbol"
38         select="$syms/symbols/release/symbol[. = $name]"/>
39     <xsl:if test="string($symbol) != $name">
40       <xsl:message terminate="yes">
41         <xsl:text>Failed to find export in symbols.xml: </xsl:text>
42         <xsl:value-of select="$name"/>
43       </xsl:message>
44     </xsl:if>
45   </xsl:template>
46
47 </xsl:stylesheet>
48