ReactOS  0.4.13-dev-1000-gbfea773
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 #include "precomp.h"
14 
15 #ifdef WITH_XSLT_DEBUG
16 #define WITH_XSLT_DEBUG_EXTRA
17 #endif
18 
19 /************************************************************************
20  * *
21  * Handling of XSLT debugging *
22  * *
23  ************************************************************************/
24 
34 void
38 {
39  int i, j;
40 
42  for (i = 0, j = ctxt->templNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
44  if (ctxt->templTab[j]->name != NULL)
46  ctxt->templTab[j]->name);
47  if (ctxt->templTab[j]->match != NULL)
49  ctxt->templTab[j]->match);
50  if (ctxt->templTab[j]->mode != NULL)
52  ctxt->templTab[j]->mode);
54  }
56  for (i = 0, j = ctxt->varsNr - 1; ((i < 15) && (j >= 0)); i++, j--) {
57  xsltStackElemPtr cur;
58 
59  if (ctxt->varsTab[j] == NULL)
60  continue;
62  cur = ctxt->varsTab[j];
63  while (cur != NULL) {
64  if (cur->comp == NULL) {
66  "corrupted !!!\n");
67  } else if (cur->comp->type == XSLT_FUNC_PARAM) {
69  } else if (cur->comp->type == XSLT_FUNC_VARIABLE) {
71  }
72  if (cur->name != NULL)
74  cur->name);
75  else
77 #ifdef LIBXML_DEBUG_ENABLED
78  if (cur->value != NULL) {
81  xmlXPathDebugDumpObject((FILE*)xsltGenericDebugContext,
82  cur->value, 1);
83  } else {
85  }
86 #endif
88  cur = cur->next;
89  }
90 
91  }
92 }
93 
94 /************************************************************************
95  * *
96  * Classic extensions as described by M. Kay *
97  * *
98  ************************************************************************/
99 
110 void
111 xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
112  if (nargs != 1) {
114  "node-set() : expects one result-tree arg\n");
115  ctxt->error = XPATH_INVALID_ARITY;
116  return;
117  }
118  if ((ctxt->value == NULL) ||
119  ((ctxt->value->type != XPATH_XSLT_TREE) &&
120  (ctxt->value->type != XPATH_NODESET))) {
122  "node-set() invalid arg expecting a result tree\n");
123  ctxt->error = XPATH_INVALID_TYPE;
124  return;
125  }
126  if (ctxt->value->type == XPATH_XSLT_TREE) {
127  ctxt->value->type = XPATH_NODESET;
128  }
129 }
130 
138 void
141 }
142 
148 void
150  xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
153  xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
156  xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
159  xsltRegisterExtModuleElement((const xmlChar *) "debug",
161  NULL,
162  xsltDebug);
163  xsltRegisterExtModuleElement((const xmlChar *) "output",
167  xsltRegisterExtModuleElement((const xmlChar *) "write",
171  xsltRegisterExtModuleElement((const xmlChar *) "document",
175  xsltRegisterExtModuleElement((const xmlChar *) "document",
179 }
void xsltRegisterExtras(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED)
Definition: extra.c:139
const xmlChar * mode
const xmlChar * name
struct _xsltStackElem * next
#define XSLT_NAMESPACE
Definition: xslt.h:46
FILE * stdout
void xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:3335
#define XSLT_XT_NAMESPACE
Definition: extra.h:41
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
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
xsltTemplatePtr * templTab
smooth NULL
Definition: ftsmooth.c:416
xsltStyleType type
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 XSLT_SAXON_NAMESPACE
Definition: extra.h:34
void * xsltGenericDebugContext
Definition: xsltutils.c:549
int xsltRegisterExtModuleFunction(const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:1385
void xsltRegisterAllExtras(void)
Definition: extra.c:149
#define XSLT_LIBXSLT_NAMESPACE
Definition: extra.h:27
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: tree.h:489
#define ATTRIBUTE_UNUSED
Definition: win32config.h:132
xsltStylePreCompPtr comp
unsigned char xmlChar
Definition: xmlstring.h:28
xsltElemPreCompPtr xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function ATTRIBUTE_UNUSED)
Definition: preproc.c:508
xsltStackElemPtr * varsTab
void xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs)
Definition: extra.c:111
xmlXPathObjectPtr value
xsltTransformContextPtr xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
Definition: extensions.c:1367
FILE * stderr
void xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst ATTRIBUTE_UNUSED, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: extra.c:35
xmlChar * match
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
#define XSLT_XALAN_NAMESPACE
Definition: extra.h:48
const xmlChar * name
int xsltRegisterExtModuleElement(const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:1623
Definition: dlist.c:348