mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-31 02:43:06 +03:00
fixup the script and rebuid the API cleanup provided accessors for a lot
* doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml doc/parsedecl.py: fixup the script and rebuid the API * libxslt/extensions.h: cleanup * python/generator.py python/libxslt-python-api.xml python/libxslt.c python/libxsltclass.txt: provided accessors for a lot of the tructures involved in the transformation. Stylesheet and transformation python object don't free automatically the encapsulated object when deallocated. * python/tests/Makefile.am python/tests/basic.py python/tests/extfunc.py python/tests/pyxsltproc.py: updated the examples Daniel
This commit is contained in:
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
Thu Feb 7 23:21:18 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml
|
||||
doc/parsedecl.py: fixup the script and rebuid the API
|
||||
* libxslt/extensions.h: cleanup
|
||||
* python/generator.py python/libxslt-python-api.xml python/libxslt.c
|
||||
python/libxsltclass.txt: provided accessors for a lot of the
|
||||
tructures involved in the transformation. Stylesheet and
|
||||
transformation python object don't free automatically the
|
||||
encapsulated object when deallocated.
|
||||
* python/tests/Makefile.am python/tests/basic.py
|
||||
python/tests/extfunc.py python/tests/pyxsltproc.py:
|
||||
updated the examples
|
||||
|
||||
Thu Feb 7 17:59:27 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xsltproc/xsltproc.c: small fix
|
||||
|
@ -69,7 +69,7 @@
|
||||
<exports symbol='xsltExtElementLookup'/>
|
||||
<exports symbol='xsltExtModuleElementLookup'/>
|
||||
<exports symbol='xsltUnregisterExtModuleElement'/>
|
||||
<exports symbol='void'/>
|
||||
<exports symbol='xsltTopLevelFunction'/>
|
||||
<exports symbol='xsltRegisterExtModuleTopLevel'/>
|
||||
<exports symbol='xsltExtModuleTopLevelLookup'/>
|
||||
<exports symbol='xsltUnregisterExtModuleTopLevel'/>
|
||||
@ -423,11 +423,6 @@
|
||||
<macro name='XSLT_XT_NAMESPACE' file='extra'>
|
||||
<info>This is James Clark's XT processor namespace for extensions</info>
|
||||
</macro>
|
||||
<function name='void' file='extensions'>
|
||||
<return type='typedef'/>
|
||||
<arg name='style' type='*xsltTopLevelFunction) (xsltStylesheetPtr'/>
|
||||
<arg name='inst' type='xmlNodePtr'/>
|
||||
</function>
|
||||
<function name='xslAddCall' file='xsltutils'>
|
||||
<info>Add template "call" to call stack</info>
|
||||
<return type='int' info=': 1 on sucess 0 otherwise an error may be printed if WITH_XSLT_DEBUG_BREAKPOINTS is defined '/>
|
||||
@ -1499,6 +1494,11 @@
|
||||
<info>Used for gathering profiling data</info>
|
||||
<return type='long' info='the number of tenth of milliseconds since the beginning of the profiling '/>
|
||||
</function>
|
||||
<functype name='xsltTopLevelFunction' file='extensions'>
|
||||
<return type='void'/>
|
||||
<arg name='style' type='xsltStylesheetPtr'/>
|
||||
<arg name='inst' type='xmlNodePtr'/>
|
||||
</functype>
|
||||
<struct name='xsltTransformContext' file='xsltInternals'/>
|
||||
<typedef name='xsltTransformContextPtr' file='xsltInternals'/>
|
||||
<functype name='xsltTransformFunction' file='xsltInternals'>
|
||||
|
@ -797,11 +797,12 @@ const xmlChar *name,const xmlChar *URI
|
||||
<RETURNS>int </RETURNS>
|
||||
const xmlChar *name,const xmlChar *URI
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>void</NAME>
|
||||
<RETURNS>typedef </RETURNS>
|
||||
*xsltTopLevelFunction) (xsltStylesheetPtr style,xmlNodePtr inst
|
||||
</FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>xsltTopLevelFunction</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr inst
|
||||
</USER_FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>xsltRegisterExtModuleTopLevel</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
@ -809,7 +810,7 @@ const xmlChar *name,const xmlChar *URI,xsltTopLevelFunction function
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>xsltExtModuleTopLevelLookup</NAME>
|
||||
<RETURNS>xsltTopLevelFunction</RETURNS>
|
||||
<RETURNS>xsltTopLevelFunction </RETURNS>
|
||||
const xmlChar *name,const xmlChar *URI
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
|
@ -35,7 +35,6 @@
|
||||
<reference name='XSLT_TODO' href='html/libxslt-xsltutils.html#XSLT-TODO-CAPS'/>
|
||||
<reference name='XSLT_XALAN_NAMESPACE' href='html/libxslt-extra.html#XSLT-XALAN-NAMESPACE-CAPS'/>
|
||||
<reference name='XSLT_XT_NAMESPACE' href='html/libxslt-extra.html#XSLT-XT-NAMESPACE-CAPS'/>
|
||||
<reference name='void' href='html/libxslt-extensions.html#VOID'/>
|
||||
<reference name='xslAddCall' href='html/libxslt-xsltutils.html#XSLADDCALL'/>
|
||||
<reference name='xslDropCall' href='html/libxslt-xsltutils.html#XSLDROPCALL'/>
|
||||
<reference name='xslHandleDebugger' href='html/libxslt-transform.html#XSLHANDLEDEBUGGER'/>
|
||||
@ -283,9 +282,6 @@
|
||||
<ref name='XSLT_XALAN_NAMESPACE'/>
|
||||
<ref name='XSLT_XT_NAMESPACE'/>
|
||||
</letter>
|
||||
<letter name='v'>
|
||||
<ref name='void'/>
|
||||
</letter>
|
||||
<letter name='x'>
|
||||
<ref name='xslAddCall'/>
|
||||
<ref name='xslDropCall'/>
|
||||
@ -495,7 +491,6 @@
|
||||
</type>
|
||||
<type name='typedef'>
|
||||
<ref name='xsltElemPreCompPtr'/>
|
||||
<ref name='void'/>
|
||||
</type>
|
||||
<type name='void *'>
|
||||
<ref name='xsltStyleExtInitFunction'/>
|
||||
@ -593,9 +588,6 @@
|
||||
<type name='*xsltPreComputeFunction) (xsltStylesheetPtr'>
|
||||
<ref name='xsltElemPreCompPtr'/>
|
||||
</type>
|
||||
<type name='*xsltTopLevelFunction) (xsltStylesheetPtr'>
|
||||
<ref name='void'/>
|
||||
</type>
|
||||
<type name='FILE *'>
|
||||
<ref name='xsltApplyStylesheetUser'/>
|
||||
<ref name='xsltProfileStylesheet'/>
|
||||
@ -813,7 +805,7 @@
|
||||
<ref name='xsltElemPreCompPtr'/>
|
||||
<ref name='xsltNewElemPreComp'/>
|
||||
<ref name='xsltInitElemPreComp'/>
|
||||
<ref name='void'/>
|
||||
<ref name='xsltTopLevelFunction'/>
|
||||
<ref name='xsltPreComputeExtModuleElement'/>
|
||||
<ref name='xsltParseStylesheetImport'/>
|
||||
<ref name='xsltParseStylesheetInclude'/>
|
||||
@ -972,6 +964,7 @@
|
||||
<ref name='xsltShutdownExts'/>
|
||||
<ref name='xsltNewElemPreComp'/>
|
||||
<ref name='xsltInitElemPreComp'/>
|
||||
<ref name='xsltTopLevelFunction'/>
|
||||
<ref name='xsltRegisterExtPrefix'/>
|
||||
<ref name='xsltCheckExtPrefix'/>
|
||||
<ref name='xsltFreeExts'/>
|
||||
@ -1134,7 +1127,7 @@
|
||||
<ref name='xsltExtElementLookup'/>
|
||||
<ref name='xsltExtModuleElementLookup'/>
|
||||
<ref name='xsltUnregisterExtModuleElement'/>
|
||||
<ref name='void'/>
|
||||
<ref name='xsltTopLevelFunction'/>
|
||||
<ref name='xsltRegisterExtModuleTopLevel'/>
|
||||
<ref name='xsltExtModuleTopLevelLookup'/>
|
||||
<ref name='xsltUnregisterExtModuleTopLevel'/>
|
||||
|
@ -800,7 +800,11 @@ def link(id):
|
||||
target = string.upper(ids[id])
|
||||
else:
|
||||
target = string.upper(id)
|
||||
file = 'html/libxslt-' + string.lower(hash[id]) + '.html';
|
||||
if hash.has_key(id):
|
||||
module = string.lower(hash[id])
|
||||
else:
|
||||
module = 'index'
|
||||
file = 'html/libxslt-' + module + '.html';
|
||||
return file + '#' + target
|
||||
|
||||
print "Saving XML crossreferences libxslt-refs.xml"
|
||||
|
@ -149,15 +149,13 @@ int xsltUnregisterExtModuleElement (const xmlChar *name,
|
||||
/*
|
||||
* top-level elements
|
||||
*/
|
||||
typedef void
|
||||
(*xsltTopLevelFunction) (xsltStylesheetPtr style,
|
||||
typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style,
|
||||
xmlNodePtr inst);
|
||||
|
||||
int xsltRegisterExtModuleTopLevel (const xmlChar *name,
|
||||
const xmlChar *URI,
|
||||
xsltTopLevelFunction function);
|
||||
xsltTopLevelFunction
|
||||
xsltExtModuleTopLevelLookup (const xmlChar *name,
|
||||
xsltTopLevelFunction xsltExtModuleTopLevelLookup (const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
int xsltUnregisterExtModuleTopLevel (const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
|
@ -526,8 +526,7 @@ classes_ancestor = {
|
||||
"xpathParserContext" : "libxml2.xpathParserContext",
|
||||
}
|
||||
classes_destructors = {
|
||||
"stylesheet": "xsltFreeStylesheet",
|
||||
"transformCtxt": "xsltFreeTransformContext",
|
||||
"xpathContext" : "pass"
|
||||
}
|
||||
|
||||
function_classes = {}
|
||||
@ -578,6 +577,24 @@ def nameFixup(function, classe, type, file):
|
||||
elif name[0:10] == "xmlNodeGet" and file == "python_accessor":
|
||||
func = name[10:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:18] == "xsltXPathParserGet" and file == "python_accessor":
|
||||
func = name[18:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:12] == "xsltXPathGet" and file == "python_accessor":
|
||||
func = name[12:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:16] == "xsltTransformGet" and file == "python_accessor":
|
||||
func = name[16:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:16] == "xsltTransformSet" and file == "python_accessor":
|
||||
func = name[13:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:17] == "xsltStylesheetGet" and file == "python_accessor":
|
||||
func = name[17:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:17] == "xsltStylesheetSet" and file == "python_accessor":
|
||||
func = name[14:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:l] == classe:
|
||||
func = name[l:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
@ -784,6 +801,9 @@ for classname in classes_list:
|
||||
classes.write(" self._o = None\n\n");
|
||||
if classes_destructors.has_key(classname):
|
||||
classes.write(" def __del__(self):\n")
|
||||
if classes_destructors[classname] == "pass":
|
||||
classes.write(" pass\n")
|
||||
else:
|
||||
classes.write(" if self._o != None:\n")
|
||||
classes.write(" _libxslt.%s(self._o)\n" %
|
||||
classes_destructors[classname]);
|
||||
|
@ -23,6 +23,163 @@
|
||||
<info>Cleanup all libxslt and libxml2 memory allocated</info>
|
||||
<return type='void'/>
|
||||
</function>
|
||||
<function name='xsltXPathParserGetContext' file='python_accessor'>
|
||||
<info>Get the xpathContext from an xpathParserContext</info>
|
||||
<return type='xmlXPathContextPtr' info="The XPath context" field="context"/>
|
||||
<arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath parser context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetContextDoc' file='python_accessor'>
|
||||
<info>Get the doc from an xpathContext</info>
|
||||
<return type='xmlDocPtr' info="The doc context" field="doc"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetContextNode' file='python_accessor'>
|
||||
<info>Get the current node from an xpathContext</info>
|
||||
<return type='xmlNodePtr' info="The node context" field="node"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetContextPosition' file='python_accessor'>
|
||||
<info>Get the current node from an xpathContext</info>
|
||||
<return type='int' info="The node context" field="proximityPosition"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetContextSize' file='python_accessor'>
|
||||
<info>Get the current node from an xpathContext</info>
|
||||
<return type='int' info="The node context" field="contextSize"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetFunction' file='python_accessor'>
|
||||
<info>Get the current function name xpathContext</info>
|
||||
<return type='const xmlChar *' info="The function name" field="function"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetFunctionURI' file='python_accessor'>
|
||||
<info>Get the current function name URI xpathContext</info>
|
||||
<return type='const xmlChar *' info="The function name URI" field="functionURI"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltXPathGetTransformContext' file='python_accessor'>
|
||||
<info>Get the transformation context from an xpathContext</info>
|
||||
<return type='xsltTransformContextPtr' info="The node context" field="extra"/>
|
||||
<arg name='ctxt' type='xmlXPathContextPtr' info='the XPath context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetStyle' file='python_accessor'>
|
||||
<info>Get the stylesheet from a transformation</info>
|
||||
<return type='xsltStylesheetPtr' info="The stylesheet" field="style"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetCurrent' file='python_accessor'>
|
||||
<info>Get the current() node of a transformation</info>
|
||||
<return type='xmlNodePtr' info="The node" field="node"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetOutputDoc' file='python_accessor'>
|
||||
<info>Get the output document of a transformation</info>
|
||||
<return type='xmlDocPtr' info="The output doc" field="output"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetOutputURI' file='python_accessor'>
|
||||
<info>Get the output URI of a transformation if known</info>
|
||||
<return type='const char *' info="The output URI" field="outputFile"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetInsertNode' file='python_accessor'>
|
||||
<info>Get the insertion node in the output document</info>
|
||||
<return type='xmlNodePtr' info="The insertion node" field="insert"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetInstruction' file='python_accessor'>
|
||||
<info>Get the instruction node in the stylesheet</info>
|
||||
<return type='xmlNodePtr' info="The instruction node" field="inst"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetMode' file='python_accessor'>
|
||||
<info>Get the mode of a transformation</info>
|
||||
<return type='const xmlChar *' info="The mode" field="mode"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetModeURI' file='python_accessor'>
|
||||
<info>Get the mode URI of a transformation</info>
|
||||
<return type='const xmlChar *' info="The mode URI" field="modeURI"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetContext' file='python_accessor'>
|
||||
<info>Get the XPath context of a transformation</info>
|
||||
<return type='xmlXPathContextPtr' info="The XPath context" field="xpathCtxt"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformGetPrivate' file='python_accessor'>
|
||||
<info>Get the private field of a transformation</info>
|
||||
<return type='pythonObject *' info="The private field" field="_private"/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
</function>
|
||||
<function name='xsltTransformSetPrivate' file='python_accessor'>
|
||||
<info>Set the private field of a transformation</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xsltTransformContextPtr' info='the transformation context'/>
|
||||
<arg name='_private' type='pythonObject *' info='The private field'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetParent' file='python_accessor'>
|
||||
<info>Get the parent of a stylesheet</info>
|
||||
<return type='xsltStylesheetPtr' info="The parent" field="parent"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetNext' file='python_accessor'>
|
||||
<info>Get the next sibling of a stylesheet</info>
|
||||
<return type='xsltStylesheetPtr' info="The next sibling" field="next"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetImports' file='python_accessor'>
|
||||
<info>Get the imports of a stylesheet</info>
|
||||
<return type='xsltStylesheetPtr' info="The next sibling" field="imports"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetDoc' file='python_accessor'>
|
||||
<info>Get the document of a stylesheet</info>
|
||||
<return type='xmlDocPtr' info="The XML document" field="doc"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetMethod' file='python_accessor'>
|
||||
<info>Get the output method of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output method" field="method"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetMethodURI' file='python_accessor'>
|
||||
<info>Get the output method URI of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output method URI" field="methodURI"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetVersion' file='python_accessor'>
|
||||
<info>Get the output version of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output version" field="version"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetEncoding' file='python_accessor'>
|
||||
<info>Get the output encoding of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output encoding" field="encoding"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetDoctypePublic' file='python_accessor'>
|
||||
<info>Get the output PUBLIC of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output PUBLIC" field="doctypePublic"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetDoctypeSystem' file='python_accessor'>
|
||||
<info>Get the output SYSTEM of a stylesheet</info>
|
||||
<return type='xmlChar *' info="The output SYSTEM" field="doctypeSystem"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetGetPrivate' file='python_accessor'>
|
||||
<info>Get the private field of a stylesheet</info>
|
||||
<return type='pythonObject *' info="The private field" field="_private"/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
</function>
|
||||
<function name='xsltStylesheetSetPrivate' file='python_accessor'>
|
||||
<info>Set the private field of a stylesheet</info>
|
||||
<return type='void'/>
|
||||
<arg name='style' type='xsltStylesheetPtr' info='the stylesheet'/>
|
||||
<arg name='_private' type='pythonObject *' info='The private field'/>
|
||||
</function>
|
||||
<!--
|
||||
<function name='xsltRegisterXPathFunction' file='python'>
|
||||
<info>Register a Python written function to the XPath interpreter</info>
|
||||
|
@ -181,11 +181,12 @@ libxslt_xmlXPathFuncCallback(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
}
|
||||
|
||||
list = PyTuple_New(nargs);
|
||||
list = PyTuple_New(nargs + 1);
|
||||
PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
|
||||
for (i = 0;i < nargs;i++) {
|
||||
obj = valuePop(ctxt);
|
||||
cur = libxml_xmlXPathObjectPtrWrap(obj);
|
||||
PyTuple_SetItem(list, i, cur);
|
||||
PyTuple_SetItem(list, i + 1, cur);
|
||||
}
|
||||
result = PyEval_CallObject(current_function, list);
|
||||
Py_DECREF(list);
|
||||
|
@ -46,6 +46,8 @@ xslDropCall()
|
||||
|
||||
|
||||
Class xpathParserContext(libxml2.xpathParserContext)
|
||||
# accessors
|
||||
context()
|
||||
|
||||
# functions from module extra
|
||||
functionNodeSet()
|
||||
@ -62,10 +64,28 @@ Class xpathParserContext(libxml2.xpathParserContext)
|
||||
|
||||
|
||||
Class xpathContext(libxml2.xpathContext)
|
||||
# accessors
|
||||
contextDoc()
|
||||
contextNode()
|
||||
contextPosition()
|
||||
contextSize()
|
||||
function()
|
||||
functionURI()
|
||||
transformContext()
|
||||
|
||||
# functions from module functions
|
||||
registerAllFunctions()
|
||||
Class transformCtxt()
|
||||
# accessors
|
||||
context()
|
||||
current()
|
||||
insertNode()
|
||||
instruction()
|
||||
mode()
|
||||
modeURI()
|
||||
outputDoc()
|
||||
outputURI()
|
||||
style()
|
||||
|
||||
# functions from module attributes
|
||||
applyAttributeSet()
|
||||
@ -119,6 +139,17 @@ Class transformCtxt()
|
||||
printErrorContext()
|
||||
saveProfiling()
|
||||
Class stylesheet()
|
||||
# accessors
|
||||
doc()
|
||||
doctypePublic()
|
||||
doctypeSystem()
|
||||
encoding()
|
||||
imports()
|
||||
method()
|
||||
methodURI()
|
||||
next()
|
||||
parent()
|
||||
version()
|
||||
|
||||
# functions from module attributes
|
||||
freeAttributeSetsHashes()
|
||||
|
@ -26,6 +26,6 @@ clean:
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
|
||||
-(for test in $(TESTSPY) $(XMLS); \
|
||||
-(for test in $(TESTSPY) $(XMLS) $(EXTRAS); \
|
||||
do @INSTALL@ -m 0644 $$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
|
||||
|
||||
|
@ -11,7 +11,7 @@ style = libxslt.parseStylesheetDoc(styledoc)
|
||||
doc = libxml2.parseFile("test.xml")
|
||||
result = style.applyStylesheet(doc, None)
|
||||
style.saveResultToFilename("foo", result, 0)
|
||||
style = None
|
||||
style.freeStylesheet()
|
||||
doc.freeDoc()
|
||||
result.freeDoc()
|
||||
|
||||
|
@ -6,7 +6,22 @@ import libxslt
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
|
||||
def f(str):
|
||||
nodeName = None
|
||||
|
||||
def f(ctx, str):
|
||||
global nodeName
|
||||
|
||||
#
|
||||
# Small check to verify the context is correcly accessed
|
||||
#
|
||||
try:
|
||||
pctxt = libxslt.xpathParserContext(_obj=ctx)
|
||||
ctxt = pctxt.context()
|
||||
tctxt = ctxt.transformContext()
|
||||
nodeName = tctxt.insertNode().name
|
||||
except:
|
||||
pass
|
||||
|
||||
import string
|
||||
return string.upper(str)
|
||||
|
||||
@ -27,7 +42,7 @@ styledoc = libxml2.parseDoc("""
|
||||
style = libxslt.parseStylesheetDoc(styledoc)
|
||||
doc = libxml2.parseDoc("<doc/>")
|
||||
result = style.applyStylesheet(doc, { "bar": "'success'" })
|
||||
style = None
|
||||
style.freeStylesheet()
|
||||
doc.freeDoc()
|
||||
|
||||
root = result.children
|
||||
@ -37,6 +52,8 @@ if root.name != "article":
|
||||
if root.content != "SUCCESS":
|
||||
print "Unexpected root node content, extension function failed"
|
||||
sys.exit(1)
|
||||
if nodeName != 'article':
|
||||
print "The function callback failed to access its context"
|
||||
|
||||
result.freeDoc()
|
||||
|
||||
|
@ -283,7 +283,8 @@ def main(args = None):
|
||||
xsltProcess(doc, cur, args[i])
|
||||
i = i + 1
|
||||
|
||||
cur = None
|
||||
if cur != None:
|
||||
cur.freeStylesheet()
|
||||
params = None
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user