/* * functions.c: Implementation of the XSLT extra functions * * Reference: * http://www.w3.org/TR/1999/REC-xslt-19991116 * * See Copyright for the status of this software. * * [email protected] * Bjorn Reese <[email protected]> for number formatting */ #define IN_LIBXSLT #include "libxslt.h" #include <string.h> #include <libxml/xmlmemory.h> #include <libxml/parser.h> #include <libxml/tree.h> #include <libxml/valid.h> #include <libxml/hash.h> #include <libxml/xmlerror.h> #include <libxml/xpath.h> #include <libxml/xpathInternals.h> #include <libxml/parserInternals.h> #include <libxml/uri.h> #include <libxml/xpointer.h> #include "xslt.h" #include "xsltInternals.h" #include "xsltutils.h" #include "functions.h" #include "extensions.h" #include "numbersInternals.h" #include "keys.h" #include "documents.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_FUNCTION #endif /* * Some versions of DocBook XSL use the vendor string to detect * supporting chunking, this is a workaround to be considered * in the list of decent XSLT processors <grin/> */ #define DOCBOOK_XSL_HACK /** * xsltXPathFunctionLookup: * @vctxt: a void * but the XSLT transformation context actually * @name: the function name * @ns_uri: the function namespace URI * * This is the entry point when a function is needed by the XPath * interpretor. * * Returns the callback function or NULL if not found */ xmlXPathFunction xsltXPathFunctionLookup (void *vctxt, const xmlChar *name, const xmlChar *ns_uri) { … } /************************************************************************ * * * Module interfaces * * * ************************************************************************/ static void xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, const xmlChar* URI, const xmlChar *fragment) { … } /** * xsltDocumentFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the document() XSLT function * node-set document(object, node-set?) */ void xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) { … } /** * xsltKeyFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the key() XSLT function * node-set key(string, object) */ void xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltUnparsedEntityURIFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the unparsed-entity-uri() XSLT function * string unparsed-entity-uri(string) */ void xsltUnparsedEntityURIFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltFormatNumberFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the format-number() XSLT function * string format-number(number, string, string?) */ void xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) { … } /** * xsltGenerateIdFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the generate-id() XSLT function * string generate-id(node-set?) */ void xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltSystemPropertyFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the system-property() XSLT function * object system-property(string) */ void xsltSystemPropertyFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltElementAvailableFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the element-available() XSLT function * boolean element-available(string) */ void xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltFunctionAvailableFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the function-available() XSLT function * boolean function-available(string) */ void xsltFunctionAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /** * xsltCurrentFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the current() XSLT function * node-set current() */ static void xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){ … } /************************************************************************ * * * Registration of XSLT and libxslt functions * * * ************************************************************************/ /** * xsltRegisterAllFunctions: * @ctxt: the XPath context * * Registers all default XSLT functions in this context */ void xsltRegisterAllFunctions(xmlXPathContextPtr ctxt) { … }