checkapisym.xsl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. version="1.0">
  8. <xsl:output method="text" encoding="UTF-8"/>
  9. <xsl:variable name="syms" select="document('symbols.xml')"/>
  10. <xsl:template match="/">
  11. <xsl:message terminate="no">
  12. <xsl:text>Looking for functions in symbols.xml</xsl:text>
  13. </xsl:message>
  14. <xsl:apply-templates select="/api/symbols/function"/>
  15. <xsl:message terminate="no">
  16. <xsl:text>Found </xsl:text>
  17. <xsl:value-of select="count(/api/symbols/function)"/>
  18. <xsl:text> functions</xsl:text>
  19. </xsl:message>
  20. <xsl:message terminate="no">
  21. <xsl:text>Looking for variables in symbols.xml</xsl:text>
  22. </xsl:message>
  23. <xsl:apply-templates select="/api/symbols/variable"/>
  24. <xsl:message terminate="no">
  25. <xsl:text>Found </xsl:text>
  26. <xsl:value-of select="count(/api/symbols/variable)"/>
  27. <xsl:text> variables</xsl:text>
  28. </xsl:message>
  29. </xsl:template>
  30. <xsl:template match="function|variable">
  31. <xsl:variable name="name" select="@name"/>
  32. <xsl:variable name="symbol"
  33. select="$syms/symbols/release/symbol[. = $name]"/>
  34. <xsl:if test="string($symbol) != $name">
  35. <xsl:message terminate="yes">
  36. <xsl:text>Failed to find export in symbols.xml: </xsl:text>
  37. <xsl:value-of select="$name"/>
  38. </xsl:message>
  39. </xsl:if>
  40. </xsl:template>
  41. </xsl:stylesheet>