Skip to content
Snippets Groups Projects
Commit fd33194f2755 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

Set-up framework for XSLT functions:

- libxslt/functions.[ch] Makefile.am: added new module functions
  with templates for the XSLT functions.
- libxslt/variables.h templates.c: added registrations of new
  functions when an XPath context is created
Daniel
parent 0e6f3c0e5fc4
No related branches found
No related tags found
No related merge requests found
Wed Jan 24 05:33:54 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/functions.[ch] Makefile.am: added new module functions
with templates for the XSLT functions.
* libxslt/variables.h templates.c: added registrations of new
functions when an XPath context is created
Tue Jan 23 17:24:26 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* tests/Makefile.am: cleanup
......
......@@ -11,6 +11,7 @@
pattern.h \
templates.h \
variables.h \
functions.h \
transform.h \
xsltInternals.h
......@@ -20,6 +21,7 @@
pattern.c \
templates.c \
variables.c \
functions.c \
transform.c
......
/*
* 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.
*
* Daniel.Veillard@imag.fr
*/
#include "xsltconfig.h"
#include <string.h>
#include <libxml/xmlmemory.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 "xslt.h"
#include "xsltInternals.h"
#include "xsltutils.h"
#include "functions.h"
#define DEBUG_FUNCTION
/************************************************************************
* *
* Module interfaces *
* *
************************************************************************/
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* 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){
TODO /* function */
}
/**
* xsltCurrentFunction:
* @ctxt: the XPath Parser context
* @nargs: the number of arguments
*
* Implement the current() XSLT function
* node-set current()
*/
void
xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){
TODO /* function */
}
/**
* xsltRegisterAllFunctions:
* @ctxt: the XPath context
*
* Registers all default XSLT functions in this context
*/
void
xsltRegisterAllFunctions(xmlXPathContextPtr ctxt) {
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"current",
xsltCurrentFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"document",
xsltDocumentFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"key",
xsltKeyFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"unparsed-entity-uri",
xsltUnparsedEntityURIFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"format-number",
xsltFormatNumberFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"generate-id",
xsltGenerateIdFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"system-property",
xsltSystemPropertyFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"element-available",
xsltElementAvailableFunction);
xmlXPathRegisterFunc(ctxt, (const xmlChar *)"function-available",
xsltFunctionAvailableFunction);
}
/*
* functions.h: interface for the XSLT extra functions
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@imag.fr
*/
#ifndef __XML_XSLT_FUNCTIONS_H__
#define __XML_XSLT_FUNCTIONS_H__
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "xsltInternals.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Interfaces for the functions implementations
*/
void xsltDocumentFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltKeyFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt,
int nargs);
void xsltXXXFunction (xmlXPathParserContextPtr ctxt,
int nargs);
/*
* And the registration
*/
void xsltRegisterAllFunctions (xmlXPathContextPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* __XML_XSLT_FUNCTIONS_H__ */
......@@ -22,6 +22,7 @@
#include "xsltInternals.h"
#include "xsltutils.h"
#include "variables.h"
#include "functions.h"
#include "templates.h"
#define DEBUG_TEMPLATES
......
......@@ -12,6 +12,7 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "xsltInternals.h"
#include "functions.h"
#ifdef __cplusplus
extern "C" {
......@@ -19,7 +20,8 @@
#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \
xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \
xsltXPathVariableLookup, (void *)(ctxt))
xsltXPathVariableLookup, (void *)(ctxt)); \
xsltRegisterAllFunctions((ctxt)->xpathCtxt)
/*
* Interfaces for the variable module.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment