4 This stylesheet is used to transform doc/libxml2-api.xml into a pseudo-source,
5 which can then be preprocessed to get the .DEF file for the Microsoft's linker.
7 Use any XSLT processor to produce a file called libxml2.def.src in the win32
8 subdirectory, for example, run xsltproc from the win32 subdirectory:
10 xsltproc -o libxml2.def.src defgen.xsl ../doc/libxml2-api.xml
12 Once that finishes, rest assured, the Makefile will know what to do with the
15 April 2003, Igor Zlatkovic <igor@zlatkovic.com>
17 <!DOCTYPE xsl:stylesheet [
<!ENTITY nl '

'
> ]
>
18 <xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform">
19 <xsl:strip-space elements=
"*"/>
20 <xsl:output method=
"text"/>
21 <xsl:template match=
"/">
22 <xsl:text>#define LIBXML2_COMPILING_MSCCDEF
&nl;</xsl:text>
23 <xsl:text>#include
"../include/libxml/xmlversion.h"&nl;</xsl:text>
24 <xsl:text>LIBRARY libxml2
&nl;</xsl:text>
25 <xsl:text>EXPORTS
&nl;</xsl:text>
26 <xsl:for-each select=
"/api/symbols/*[self::variable or self::function]">
28 <xsl:if test=
"@file = 'c14n'">
29 <xsl:text>#ifdef LIBXML_C14N_ENABLED
&nl;</xsl:text>
31 <xsl:if test=
"@file = 'catalog'">
32 <xsl:text>#ifdef LIBXML_CATALOG_ENABLED
&nl;</xsl:text>
34 <xsl:if test=
"@file = 'debugXML'">
35 <xsl:text>#ifdef LIBXML_DEBUG_ENABLED
&nl;</xsl:text>
37 <xsl:if test=
"@file = 'DOCBparser'">
38 <xsl:text>#ifdef LIBXML_DOCB_ENABLED
&nl;</xsl:text>
40 <xsl:if test=
"(@file = 'HTMLparser')
41 or (@file = 'HTMLtree')">
42 <xsl:text>#ifdef LIBXML_HTML_ENABLED
&nl;</xsl:text>
44 <xsl:if test=
"@file = 'nanohttp'">
45 <xsl:text>#ifdef LIBXML_HTTP_ENABLED
&nl;</xsl:text>
47 <xsl:if test=
"@file = 'nanoftp'">
48 <xsl:text>#ifdef LIBXML_FTP_ENABLED
&nl;</xsl:text>
50 <xsl:if test=
"(@file = 'relaxng')
51 or (@file = 'xmlschemas')
52 or (@file = 'xmlschemastypes')">
53 <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED
&nl;</xsl:text>
55 <xsl:if test=
"@file = 'xinclude'">
56 <xsl:text>#ifdef LIBXML_XINCLUDE_ENABLED
&nl;</xsl:text>
58 <xsl:if test=
"@file = 'xlink'">
59 <xsl:text>#ifdef LIBXML_XLINK_ENABLED
&nl;</xsl:text>
61 <xsl:if test=
"@file = 'xmlautomata'">
62 <xsl:text>#ifdef LIBXML_AUTOMATA_ENABLED
&nl;</xsl:text>
64 <xsl:if test=
"(@file = 'xmlregexp')
65 or (@file = 'xmlunicode')">
66 <xsl:text>#ifdef LIBXML_REGEXP_ENABLED
&nl;</xsl:text>
68 <xsl:if test=
"(@file = 'xpath')
69 or (@file = 'xpathInternals')">
70 <xsl:text>#ifdef LIBXML_XPATH_ENABLED
&nl;</xsl:text>
72 <xsl:if test=
"@file = 'xpointer'">
73 <xsl:text>#ifdef LIBXML_XPTR_ENABLED
&nl;</xsl:text>
75 <!-- Extended tests -->
76 <xsl:if test=
"(@name = 'htmlDefaultSAXHandlerInit')
77 or (@name = 'htmlInitAutoClose')
78 or (@name = 'htmlCreateFileParserCtxt')
79 or (@name = 'inithtmlDefaultSAXHandler')
80 or (@name = 'xmlIsXHTML')
81 or (@name = 'xmlIOHTTPOpenW')
82 or (@name = 'xmlRegisterHTTPPostCallbacks')
83 or (@name = 'xmlIOHTTPMatch')
84 or (@name = 'xmlIOHTTPOpen')
85 or (@name = 'xmlIOHTTPRead')
86 or (@name = 'xmlIOHTTPClose')">
87 <xsl:text>#ifdef LIBXML_HTML_ENABLED
&nl;</xsl:text>
89 <xsl:if test=
"(@name = 'docbDefaultSAXHandlerInit')
90 or (@name = 'initdocbDefaultSAXHandler')">
91 <xsl:text>#ifdef LIBXML_DOCB_ENABLED
&nl;</xsl:text>
93 <xsl:if test=
"@name = 'xmlValidBuildContentModel'">
94 <xsl:text>#ifdef LIBXML_REGEXP_ENABLED
&nl;</xsl:text>
96 <xsl:if test=
"(@name = 'xmlIOFTPMatch')
97 or (@name = 'xmlIOFTPOpen')
98 or (@name = 'xmlIOFTPRead')
99 or (@name = 'xmlIOFTPClose')">
100 <xsl:text>#ifdef LIBXML_FTP_ENABLED
&nl;</xsl:text>
102 <xsl:if test=
"(@name = 'xmlTextReaderRelaxNGValidate')
103 or (@name = 'xmlTextReaderRelaxNGSetSchema')">
104 <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED
&nl;</xsl:text>
106 <xsl:if test=
"(@name = 'xmlXPathDebugDumpObject')
107 or (@name = 'xmlXPathDebugDumpCompExpr')">
108 <xsl:text>#ifdef LIBXML_DEBUG_ENABLED
&nl;</xsl:text>
110 <xsl:if test=
"(@name = 'xmlMallocLoc')
111 or (@name = 'xmlMallocAtomicLoc')
112 or (@name = 'xmlReallocLoc')
113 or (@name = 'xmlMemStrdupLoc')">
114 <xsl:text>#ifdef DEBUG_MEMORY_LOCATION
&nl;</xsl:text>
118 <xsl:when test=
"(@name = 'xmlMalloc')
119 or (@name = 'xmlMallocAtomic')
120 or (@name = 'xmlRealloc')
121 or (@name = 'xmlFree')
122 or (@name = 'xmlMemStrdup')">
123 <xsl:text>#ifdef LIBXML_THREAD_ALLOC_ENABLED
&nl;</xsl:text>
124 <xsl:text>__
</xsl:text>
125 <xsl:value-of select=
"@name"/>
126 <xsl:text>&nl;</xsl:text>
127 <xsl:text>#else
&nl;</xsl:text>
128 <xsl:value-of select=
"@name"/>
129 <xsl:text> DATA
&nl;</xsl:text>
130 <xsl:text>#endif
&nl;</xsl:text>
132 <xsl:when test=
"(@name = 'docbDefaultSAXHandler')
133 or (@name = 'htmlDefaultSAXHandler')
134 or (@name = 'oldXMLWDcompatibility')
135 or (@name = 'xmlBufferAllocScheme')
136 or (@name = 'xmlDefaultBufferSize')
137 or (@name = 'xmlDefaultSAXHandler')
138 or (@name = 'xmlDefaultSAXLocator')
139 or (@name = 'xmlDoValidityCheckingDefaultValue')
140 or (@name = 'xmlGenericError')
141 or (@name = 'xmlGenericErrorContext')
142 or (@name = 'xmlGetWarningsDefaultValue')
143 or (@name = 'xmlIndentTreeOutput')
144 or (@name = 'xmlTreeIndentString')
145 or (@name = 'xmlKeepBlanksDefaultValue')
146 or (@name = 'xmlLineNumbersDefaultValue')
147 or (@name = 'xmlLoadExtDtdDefaultValue')
148 or (@name = 'xmlParserDebugEntities')
149 or (@name = 'xmlParserVersion')
150 or (@name = 'xmlPedanticParserDefaultValue')
151 or (@name = 'xmlSaveNoEmptyTags')
152 or (@name = 'xmlSubstituteEntitiesDefaultValue')
153 or (@name = 'xmlRegisterNodeDefaultValue')
154 or (@name = 'xmlDeregisterNodeDefaultValue')">
155 <xsl:text>#ifdef LIBXML_THREAD_ENABLED
&nl;</xsl:text>
156 <xsl:if test=
"@name = 'docbDefaultSAXHandler'">
157 <xsl:text>#ifdef LIBXML_DOCB_ENABLED
&nl;</xsl:text>
159 <xsl:if test=
"@name = 'htmlDefaultSAXHandler'">
160 <xsl:text>#ifdef LIBXML_HTML_ENABLED
&nl;</xsl:text>
162 <xsl:text>__
</xsl:text>
163 <xsl:value-of select=
"@name"/>
164 <xsl:text>&nl;</xsl:text>
165 <xsl:if test=
"@name = 'docbDefaultSAXHandler'">
166 <xsl:text>#endif
&nl;</xsl:text>
168 <xsl:if test=
"@name = 'htmlDefaultSAXHandler'">
169 <xsl:text>#endif
&nl;</xsl:text>
171 <xsl:text>#else
&nl;</xsl:text>
172 <xsl:if test=
"@name = 'docbDefaultSAXHandler'">
173 <xsl:text>#ifdef LIBXML_DOCB_ENABLED
&nl;</xsl:text>
175 <xsl:if test=
"@name = 'htmlDefaultSAXHandler'">
176 <xsl:text>#ifdef LIBXML_HTML_ENABLED
&nl;</xsl:text>
178 <xsl:value-of select=
"@name"/>
179 <xsl:text> DATA
&nl;</xsl:text>
180 <xsl:if test=
"@name = 'docbDefaultSAXHandler'">
181 <xsl:text>#endif
&nl;</xsl:text>
183 <xsl:if test=
"@name = 'htmlDefaultSAXHandler'">
184 <xsl:text>#endif
&nl;</xsl:text>
186 <xsl:text>#endif
&nl;</xsl:text>
189 <xsl:value-of select=
"@name"/>
190 <xsl:if test=
"self::variable">
191 <xsl:text> DATA
</xsl:text>
193 <xsl:text>&nl;</xsl:text>
196 <!-- Basic tests (close) -->
197 <xsl:if test=
"@file = 'c14n'">
198 <xsl:text>#endif
&nl;</xsl:text>
200 <xsl:if test=
"@file = 'catalog'">
201 <xsl:text>#endif
&nl;</xsl:text>
203 <xsl:if test=
"@file = 'debugXML'">
204 <xsl:text>#endif
&nl;</xsl:text>
206 <xsl:if test=
"@file = 'DOCBparser'">
207 <xsl:text>#endif
&nl;</xsl:text>
209 <xsl:if test=
"(@file = 'HTMLparser')
210 or (@file = 'HTMLtree')">
211 <xsl:text>#endif
&nl;</xsl:text>
213 <xsl:if test=
"@file = 'nanohttp'">
214 <xsl:text>#endif
&nl;</xsl:text>
216 <xsl:if test=
"@file = 'nanoftp'">
217 <xsl:text>#endif
&nl;</xsl:text>
219 <xsl:if test=
"(@file = 'relaxng')
220 or (@file = 'xmlschemas')
221 or (@file = 'xmlschemastypes')">
222 <xsl:text>#endif
&nl;</xsl:text>
224 <xsl:if test=
"@file = 'xinclude'">
225 <xsl:text>#endif
&nl;</xsl:text>
227 <xsl:if test=
"@file = 'xlink'">
228 <xsl:text>#endif
&nl;</xsl:text>
230 <xsl:if test=
"@file = 'xmlautomata'">
231 <xsl:text>#endif
&nl;</xsl:text>
233 <xsl:if test=
"(@file = 'xmlregexp')
234 or (@file = 'xmlunicode')">
235 <xsl:text>#endif
&nl;</xsl:text>
237 <xsl:if test=
"(@file = 'xpath')
238 or (@file = 'xpathInternals')">
239 <xsl:text>#endif
&nl;</xsl:text>
241 <xsl:if test=
"@file = 'xpointer'">
242 <xsl:text>#endif
&nl;</xsl:text>
244 <!-- Extended tests (close) -->
245 <xsl:if test=
"(@name = 'htmlDefaultSAXHandlerInit')
246 or (@name = 'htmlInitAutoClose')
247 or (@name = 'htmlCreateFileParserCtxt')
248 or (@name = 'inithtmlDefaultSAXHandler')
249 or (@name = 'xmlIsXHTML')
250 or (@name = 'xmlIOHTTPOpenW')
251 or (@name = 'xmlRegisterHTTPPostCallbacks')
252 or (@name = 'xmlIOHTTPMatch')
253 or (@name = 'xmlIOHTTPOpen')
254 or (@name = 'xmlIOHTTPRead')
255 or (@name = 'xmlIOHTTPClose')">
256 <xsl:text>#endif
&nl;</xsl:text>
258 <xsl:if test=
"(@name = 'docbDefaultSAXHandlerInit')
259 or (@name = 'initdocbDefaultSAXHandler')">
260 <xsl:text>#endif
&nl;</xsl:text>
262 <xsl:if test=
"@name = 'xmlValidBuildContentModel'">
263 <xsl:text>#endif
&nl;</xsl:text>
265 <xsl:if test=
"(@name = 'xmlIOFTPMatch')
266 or (@name = 'xmlIOFTPOpen')
267 or (@name = 'xmlIOFTPRead')
268 or (@name = 'xmlIOFTPClose')">
269 <xsl:text>#endif
&nl;</xsl:text>
271 <xsl:if test=
"(@name = 'xmlTextReaderRelaxNGValidate')
272 or (@name = 'xmlTextReaderRelaxNGSetSchema')">
273 <xsl:text>#endif
&nl;</xsl:text>
275 <xsl:if test=
"(@name = 'xmlXPathDebugDumpObject')
276 or (@name = 'xmlXPathDebugDumpCompExpr')">
277 <xsl:text>#endif
&nl;</xsl:text>
279 <xsl:if test=
"(@name = 'xmlMallocLoc')
280 or (@name = 'xmlMallocAtomicLoc')
281 or (@name = 'xmlReallocLoc')
282 or (@name = 'xmlMemStrdupLoc')">
283 <xsl:text>#endif
&nl;</xsl:text>