ReactOS 0.4.16-dev-2206-gc56950d
extra.c
Go to the documentation of this file.
1/*
2 * extra.c: Implementation of non-standard features
3 *
4 * Reference:
5 * Michael Kay "XSLT Programmer's Reference" pp 637-643
6 * The node-set() extension function
7 *
8 * See Copyright for the status of this software.
9 *
10 * daniel@veillard.com
11 */
12
13#define IN_LIBXSLT
14#include "libxslt.h"
15
16#include <string.h>
17#include <stdlib.h>
18
19#include <libxml/xmlmemory.h>
20#include <libxml/tree.h>
21#include <libxml/hash.h>
22#include <libxml/xmlerror.h>
24#include "xslt.h"
25#include "xsltInternals.h"
26#include "xsltutils.h"
27#include "extensions.h"
28#include "variables.h"
29#include "transform.h"
30#include "extra.h"
31#include "preproc.h"
32
33#ifdef WITH_XSLT_DEBUG
34#define WITH_XSLT_DEBUG_EXTRA
35#endif
36
37/************************************************************************
38 * *
39 * Handling of XSLT debugging *
40 * *
41 ************************************************************************/
42
52void
54 xmlNodePtr inst ATTRIBUTE_UNUSED,
56{
57 int i, j;
58
60 for (i = 0, j = ctxt->templNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
62 if (ctxt->templTab[j]->name != NULL)
64 ctxt->templTab[j]->name);
65 if (ctxt->templTab[j]->match != NULL)
67 ctxt->templTab[j]->match);
68 if (ctxt->templTab[j]->mode != NULL)
70 ctxt->templTab[j]->mode);
72 }
74 for (i = 0, j = ctxt->varsNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
76
77 if (ctxt->varsTab[j] == NULL)
78 continue;
80 cur = ctxt->varsTab[j];
81 while (cur != NULL) {
82 if (cur->comp == NULL) {
84 "corrupted !!!\n");
85 } else if (cur->comp->type == XSLT_FUNC_PARAM) {
87 } else if (cur->comp->type == XSLT_FUNC_VARIABLE) {
89 }
90 if (cur->name != NULL)
92 cur->name);
93 else
95#ifdef LIBXML_DEBUG_ENABLED
96 if (cur->value != NULL) {
99 xmlXPathDebugDumpObject((FILE*)xsltGenericDebugContext,
100 cur->value, 1);
101 } else {
103 }
104#endif
106 cur = cur->next;
107 }
108
109 }
110}
111
112/************************************************************************
113 * *
114 * Classic extensions as described by M. Kay *
115 * *
116 ************************************************************************/
117
128void
129xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
130 if (nargs != 1) {
132 "node-set() : expects one result-tree arg\n");
133 ctxt->error = XPATH_INVALID_ARITY;
134 return;
135 }
136 if ((ctxt->value == NULL) ||
137 ((ctxt->value->type != XPATH_XSLT_TREE) &&
138 (ctxt->value->type != XPATH_NODESET))) {
140 "node-set() invalid arg expecting a result tree\n");
141 ctxt->error = XPATH_INVALID_TYPE;
142 return;
143 }
144 if (ctxt->value->type == XPATH_XSLT_TREE) {
145 ctxt->value->type = XPATH_NODESET;
146 }
147}
148
156void
159}
160
166void
168 xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
171 xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
174 xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
177 xsltRegisterExtModuleElement((const xmlChar *) "debug",
179 NULL,
180 xsltDebug);
181 xsltRegisterExtModuleElement((const xmlChar *) "output",
185 xsltRegisterExtModuleElement((const xmlChar *) "write",
189 xsltRegisterExtModuleElement((const xmlChar *) "document",
193 xsltRegisterExtModuleElement((const xmlChar *) "document",
197}
xsltTransformContextPtr xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
Definition: extensions.c:1392
int xsltRegisterExtModuleElement(const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:1648
int xsltRegisterExtModuleFunction(const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:1410
void xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs)
Definition: extra.c:129
void xsltRegisterAllExtras(void)
Definition: extra.c:167
void xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst ATTRIBUTE_UNUSED, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: extra.c:53
void xsltRegisterExtras(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED)
Definition: extra.c:157
xsltElemPreCompPtr xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function ATTRIBUTE_UNUSED)
Definition: preproc.c:528
#define NULL
Definition: types.h:112
void xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:3363
#define stdout
#define stderr
#define XSLT_XT_NAMESPACE
Definition: extra.h:41
#define XSLT_XALAN_NAMESPACE
Definition: extra.h:48
#define XSLT_SAXON_NAMESPACE
Definition: extra.h:34
#define XSLT_LIBXSLT_NAMESPACE
Definition: extra.h:27
FxCollectionEntry * cur
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define ATTRIBUTE_UNUSED
Definition: i386-dis.c:36
const xmlChar * name
const xmlChar * mode
xmlChar * match
xsltTemplatePtr * templTab
xsltStackElemPtr * varsTab
Definition: dlist.c:348
unsigned char xmlChar
Definition: xmlstring.h:28
@ XSLT_FUNC_VARIABLE
@ XSLT_FUNC_PARAM
#define XSLT_NAMESPACE
Definition: xslt.h:46
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:762
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:586
void * xsltGenericDebugContext
Definition: xsltutils.c:633
void * xsltGenericErrorContext
Definition: xsltutils.c:587