ReactOS  0.4.14-dev-77-gd9e7c48
xsltutils.c File Reference
#include "precomp.h"
Include dependency graph for xsltutils.c:

Go to the source code of this file.

Classes

struct  _xsltDebuggerCallbacks
 

Functions

: the full QName

xsltSplitQName: @dict: a dictionary

@prefix: the return value

Split QNames into prefix and local names, both allocated from a dictionary.

Returns: the localname or NULL in case of error.

const xmlCharxsltSplitQName (xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix)
 

: the attribute name

xsltGetNsProp: @node: the node

@nameSpace: the URI of the namespace

Similar to xmlGetNsProp() but with a slightly different semantic

Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace.

This does the entity substitution. This function looks in DTD attribute declaration for FIXED or default declaration values unless DTD use has been turned off.

Returns the attribute value or NULL if not found. It's up to the caller to free the memory.

#define XSLT_GET_VAR_STR(msg, str)
 
xmlGenericErrorFunc xsltGenericError = xsltGenericErrorDefaultFunc
 
voidxsltGenericErrorContext = NULL
 
xmlGenericErrorFunc xsltGenericDebug = xsltGenericDebugDefaultFunc
 
voidxsltGenericDebugContext = NULL
 
const xmlCharxsltGetCNsProp (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace)
 
xmlCharxsltGetNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace)
 
int xsltGetUTF8Char (const unsigned char *utf, int *len)
 
void xsltMessage (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst)
 
static void LIBXSLT_ATTR_FORMAT (2, 3)
 
void xsltSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler)
 
void xsltSetGenericDebugFunc (void *ctx, xmlGenericErrorFunc handler)
 
void xsltPrintErrorContext (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node)
 
void xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, void *ctx, xmlGenericErrorFunc handler)
 
void xsltTransformError (xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
 

is

not prefixed.

#define MAX_TEMPLATES   10000
 
#define XSLT_CALLBACK_NUMBER   3
 
typedef struct _xsltDebuggerCallbacks xsltDebuggerCallbacks
 
typedef xsltDebuggerCallbacksxsltDebuggerCallbacksPtr
 
static xsltSortFunc xsltSortFunction = xsltDefaultSortFunction
 
static long calibration = -1
 
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
 
int xslDebugStatus
 
const xmlCharxsltGetQNameURI (xmlNodePtr node, xmlChar **name)
 
const xmlCharxsltGetQNameURI2 (xsltStylesheetPtr style, xmlNodePtr node, const xmlChar **name)
 
void xsltDocumentSortFunction (xmlNodeSetPtr list)
 
xmlXPathObjectPtr * xsltComputeSortResult (xsltTransformContextPtr ctxt, xmlNodePtr sort)
 
void xsltDefaultSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts)
 
void xsltDoSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts)
 
void xsltSetSortFunc (xsltSortFunc handler)
 
void xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler)
 
int xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt, int options)
 
int xsltSaveResultTo (xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style)
 
int xsltSaveResultToFilename (const char *URL, xmlDocPtr result, xsltStylesheetPtr style, int compression)
 
int xsltSaveResultToFile (FILE *file, xmlDocPtr result, xsltStylesheetPtr style)
 
int xsltSaveResultToFd (int fd, xmlDocPtr result, xsltStylesheetPtr style)
 
int xsltSaveResultToString (xmlChar **doc_txt_ptr, int *doc_txt_len, xmlDocPtr result, xsltStylesheetPtr style)
 
void xsltCalibrateAdjust (long delta)
 
long xsltTimestamp (void)
 
static charpretty_templ_match (xsltTemplatePtr templ)
 
void xsltSaveProfiling (xsltTransformContextPtr ctxt, FILE *output)
 
xmlDocPtr xsltGetProfileInformation (xsltTransformContextPtr ctxt)
 
xmlXPathCompExprPtr xsltXPathCompileFlags (xsltStylesheetPtr style, const xmlChar *str, int flags)
 
xmlXPathCompExprPtr xsltXPathCompile (xsltStylesheetPtr style, const xmlChar *str)
 
void xsltSetDebuggerStatus (int value)
 
int xsltGetDebuggerStatus (void)
 
int xsltSetDebuggerCallbacks (int no, void *block)
 
void xslHandleDebugger (xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ, xsltTransformContextPtr ctxt)
 
int xslAddCall (xsltTemplatePtr templ, xmlNodePtr source)
 
void xslDropCall (void)
 

Detailed Description

Returns the number of bytes written or -1 in case of failure.

Definition in file xsltutils.c.

Macro Definition Documentation

◆ MAX_TEMPLATES

#define MAX_TEMPLATES   10000

Definition at line 1927 of file xsltutils.c.

◆ XSLT_CALLBACK_NUMBER

#define XSLT_CALLBACK_NUMBER   3

Definition at line 2341 of file xsltutils.c.

◆ XSLT_GET_VAR_STR

#define XSLT_GET_VAR_STR (   msg,
  str 
)
Value:
{ \
int size; \
int chars; \
char *larger; \
va_list ap; \
\
str = (char *) xmlMalloc(150); \
if (str == NULL) \
return; \
\
size = 150; \
while (size < 64000) { \
va_start(ap, msg); \
chars = vsnprintf(str, size, msg, ap); \
va_end(ap); \
if ((chars > -1) && (chars < size)) \
break; \
if (chars > -1) \
size += chars + 1; \
else \
size += 100; \
if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
xmlFree(str); \
return; \
} \
str = larger; \
} \
}
#define vsnprintf
Definition: tif_win32.c:406
while(1)
Definition: macro.lex.yy.c:740
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
GLsizeiptr size
Definition: glext.h:5919
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
#define msg(x)
Definition: auth_time.c:54
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

Definition at line 453 of file xsltutils.c.

Typedef Documentation

◆ xsltDebuggerCallbacks

◆ xsltDebuggerCallbacksPtr

Definition at line 2344 of file xsltutils.c.

Function Documentation

◆ LIBXSLT_ATTR_FORMAT()

static void LIBXSLT_ATTR_FORMAT ( ,
 
)
static

xsltGenericErrorDefaultFunc: @ctx: an error context @msg: the message to display/transmit ...: extra parameters for the message display

Default handler for out of context error messages.

xsltGenericDebugDefaultFunc: @ctx: an error context @msg: the message to display/transmit ...: extra parameters for the message display

Default handler for out of context error messages.

Definition at line 490 of file xsltutils.c.

491  {
492  va_list args;
493 
495  xsltGenericErrorContext = (void *) stderr;
496 
497  va_start(args, msg);
499  va_end(args);
500 }
Definition: match.c:390
#define va_end(ap)
Definition: acmsvcex.h:90
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
void * xsltGenericErrorContext
Definition: xsltutils.c:503
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define msg(x)
Definition: auth_time.c:54
FILE * stderr
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
#define args
Definition: format.c:66

◆ pretty_templ_match()

static char* pretty_templ_match ( xsltTemplatePtr  templ)
static

Definition at line 1904 of file xsltutils.c.

1904  {
1905  static char dst[1001];
1906  char *src = (char *)templ->match;
1907  int i=0,j;
1908 
1909  /* strip white spaces */
1910  for (j=0; i<1000 && src[j]; i++,j++) {
1911  for(;src[j]==' ';j++);
1912  dst[i]=src[j];
1913  }
1914  if(i<998 && templ->mode) {
1915  /* append [mode] */
1916  dst[i++]='[';
1917  src=(char *)templ->mode;
1918  for (j=0; i<999 && src[j]; i++,j++) {
1919  dst[i]=src[j];
1920  }
1921  dst[i++]=']';
1922  }
1923  dst[i]='\0';
1924  return dst;
1925 }
const xmlChar * mode
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 for
Definition: utility.h:88
GLenum src
Definition: glext.h:6340
GLenum mode
Definition: glext.h:6217
GLenum GLenum dst
Definition: glext.h:6340
xmlChar * match

Referenced by xsltSaveProfiling().

◆ xslAddCall()

int xslAddCall ( xsltTemplatePtr  templ,
xmlNodePtr  source 
)

xslAddCall: @templ : current template being applied @source : the source node being processed

Add template "call" to call stack Returns : 1 on sucess 0 otherwise an error may be printed if WITH_XSLT_DEBUG_BREAKPOINTS is defined

Definition at line 2439 of file xsltutils.c.

2440 {
2442  return(xsltDebuggerCurrentCallbacks.add(templ, source));
2443  return(0);
2444 }
smooth NULL
Definition: ftsmooth.c:416
xsltAddCallCallback add
Definition: xsltutils.c:2347
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
Definition: xsltutils.c:2351

Referenced by xsltDebuggerStartSequenceConstructor().

◆ xslDropCall()

void xslDropCall ( void  )

xslDropCall:

Drop the topmost item off the call stack

Definition at line 2452 of file xsltutils.c.

2453 {
2456 }
xsltDropCallCallback drop
Definition: xsltutils.c:2348
smooth NULL
Definition: ftsmooth.c:416
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
Definition: xsltutils.c:2351

Referenced by xsltApplySequenceConstructor(), xsltApplyXSLTTemplate(), and xsltDebuggerStartSequenceConstructor().

◆ xslHandleDebugger()

void xslHandleDebugger ( xmlNodePtr  cur,
xmlNodePtr  node,
xsltTemplatePtr  templ,
xsltTransformContextPtr  ctxt 
)

xslHandleDebugger: @cur : source node being executed @node : data node being processed @templ : temlate that applies to node @ctxt : the xslt transform context

If either cur or node are a breakpoint, or xslDebugStatus in state where debugging must occcur at this time then transfer control to the xslDebugBreak function

Definition at line 2422 of file xsltutils.c.

2424 {
2426  xsltDebuggerCurrentCallbacks.handler(cur, node, templ, ctxt);
2427 }
smooth NULL
Definition: ftsmooth.c:416
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
Definition: xsltutils.c:2351
xsltHandleDebuggerCallback handler
Definition: xsltutils.c:2346
Definition: dlist.c:348

Referenced by xsltApplyAttributeSet(), xsltApplySequenceConstructor(), xsltApplyTemplates(), xsltAttribute(), xsltCallTemplate(), xsltChoose(), xsltDebuggerStartSequenceConstructor(), xsltEvalGlobalVariable(), and xsltForEach().

◆ xsltCalibrateAdjust()

void xsltCalibrateAdjust ( long  delta)

xsltCalibrateTimestamps:

Used for to calibrate the xsltTimestamp() function Should work if launched at startup and we don't loose our quantum :-)

Returns the number of milliseconds used by xsltTimestamp()xsltCalibrateAdjust: @delta: a negative dealy value found

Used for to correct the calibration for xsltTimestamp()

Definition at line 1802 of file xsltutils.c.

1802  {
1803  calibration += delta;
1804 }
static long calibration
Definition: xsltutils.c:1773

Referenced by xsltApplyXSLTTemplate().

◆ xsltComputeSortResult()

xmlXPathObjectPtr* xsltComputeSortResult ( xsltTransformContextPtr  ctxt,
xmlNodePtr  sort 
)

xsltComputeSortResult: @ctxt: a XSLT process context @sort: node list

reorder the current node list accordingly to the set of sorting requirement provided by the array of nodes.

Returns a ordered XPath nodeset or NULL in case of error.

Definition at line 937 of file xsltutils.c.

937  {
938 #ifdef XSLT_REFACTORED
939  xsltStyleItemSortPtr comp;
940 #else
941  xsltStylePreCompPtr comp;
942 #endif
943  xmlXPathObjectPtr *results = NULL;
944  xmlNodeSetPtr list = NULL;
945  xmlXPathObjectPtr res;
946  int len = 0;
947  int i;
948  xmlNodePtr oldNode;
949  xmlNodePtr oldInst;
950  int oldPos, oldSize ;
951  int oldNsNr;
952  xmlNsPtr *oldNamespaces;
953 
954  comp = sort->psvi;
955  if (comp == NULL) {
957  "xsl:sort : compilation failed\n");
958  return(NULL);
959  }
960 
961  if ((comp->select == NULL) || (comp->comp == NULL))
962  return(NULL);
963 
964  list = ctxt->nodeList;
965  if ((list == NULL) || (list->nodeNr <= 1))
966  return(NULL);
967 
968  len = list->nodeNr;
969 
970  /* TODO: xsl:sort lang attribute */
971  /* TODO: xsl:sort case-order attribute */
972 
973 
974  results = xmlMalloc(len * sizeof(xmlXPathObjectPtr));
975  if (results == NULL) {
977  "xsltComputeSortResult: memory allocation failure\n");
978  return(NULL);
979  }
980 
981  oldNode = ctxt->node;
982  oldInst = ctxt->inst;
983  oldPos = ctxt->xpathCtxt->proximityPosition;
984  oldSize = ctxt->xpathCtxt->contextSize;
985  oldNsNr = ctxt->xpathCtxt->nsNr;
986  oldNamespaces = ctxt->xpathCtxt->namespaces;
987  for (i = 0;i < len;i++) {
988  ctxt->inst = sort;
989  ctxt->xpathCtxt->contextSize = len;
990  ctxt->xpathCtxt->proximityPosition = i + 1;
991  ctxt->node = list->nodeTab[i];
992  ctxt->xpathCtxt->node = ctxt->node;
993 #ifdef XSLT_REFACTORED
994  if (comp->inScopeNs != NULL) {
995  ctxt->xpathCtxt->namespaces = comp->inScopeNs->list;
996  ctxt->xpathCtxt->nsNr = comp->inScopeNs->xpathNumber;
997  } else {
998  ctxt->xpathCtxt->namespaces = NULL;
999  ctxt->xpathCtxt->nsNr = 0;
1000  }
1001 #else
1002  ctxt->xpathCtxt->namespaces = comp->nsList;
1003  ctxt->xpathCtxt->nsNr = comp->nsNr;
1004 #endif
1005  res = xmlXPathCompiledEval(comp->comp, ctxt->xpathCtxt);
1006  if (res != NULL) {
1007  if (res->type != XPATH_STRING)
1008  res = xmlXPathConvertString(res);
1009  if (comp->number)
1010  res = xmlXPathConvertNumber(res);
1011  res->index = i; /* Save original pos for dupl resolv */
1012  if (comp->number) {
1013  if (res->type == XPATH_NUMBER) {
1014  results[i] = res;
1015  } else {
1016 #ifdef WITH_XSLT_DEBUG_PROCESS
1018  "xsltComputeSortResult: select didn't evaluate to a number\n");
1019 #endif
1020  results[i] = NULL;
1021  }
1022  } else {
1023  if (res->type == XPATH_STRING) {
1024  if (comp->locale != (xsltLocale)0) {
1025  xmlChar *str = res->stringval;
1026  res->stringval = (xmlChar *) xsltStrxfrm(comp->locale, str);
1027  xmlFree(str);
1028  }
1029 
1030  results[i] = res;
1031  } else {
1032 #ifdef WITH_XSLT_DEBUG_PROCESS
1034  "xsltComputeSortResult: select didn't evaluate to a string\n");
1035 #endif
1036  results[i] = NULL;
1037  }
1038  }
1039  } else {
1040  ctxt->state = XSLT_STATE_STOPPED;
1041  results[i] = NULL;
1042  }
1043  }
1044  ctxt->node = oldNode;
1045  ctxt->inst = oldInst;
1046  ctxt->xpathCtxt->contextSize = oldSize;
1047  ctxt->xpathCtxt->proximityPosition = oldPos;
1048  ctxt->xpathCtxt->nsNr = oldNsNr;
1049  ctxt->xpathCtxt->namespaces = oldNamespaces;
1050 
1051  return(results);
1052 }
xmlNodeSetPtr nodeList
xsltLocaleChar * xsltStrxfrm(xsltLocale locale, const xmlChar *string)
Definition: xsltlocale.c:359
Definition: tree.h:389
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition: _algo.c:993
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
xsltTransformState state
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
xmlXPathContextPtr xpathCtxt
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
struct _test_info results[8]
Definition: SetCursorPos.c:29
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
xmlXPathCompExprPtr comp
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
const xmlChar * select
GLuint res
Definition: glext.h:9613

Referenced by xsltDefaultSortFunction().

◆ xsltDefaultSortFunction()

void xsltDefaultSortFunction ( xsltTransformContextPtr  ctxt,
xmlNodePtr sorts,
int  nbsorts 
)

xsltDefaultSortFunction: @ctxt: a XSLT process context @sorts: array of sort nodes @nbsorts: the number of sorts in the array

reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes.

Definition at line 1064 of file xsltutils.c.

1065  {
1066 #ifdef XSLT_REFACTORED
1067  xsltStyleItemSortPtr comp;
1068 #else
1069  xsltStylePreCompPtr comp;
1070 #endif
1071  xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT];
1072  xmlXPathObjectPtr *results = NULL, *res;
1073  xmlNodeSetPtr list = NULL;
1074  int descending, number, desc, numb;
1075  int len = 0;
1076  int i, j, incr;
1077  int tst;
1078  int depth;
1079  xmlNodePtr node;
1080  xmlXPathObjectPtr tmp;
1081  int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT];
1082 
1083  if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) ||
1084  (nbsorts >= XSLT_MAX_SORT))
1085  return;
1086  if (sorts[0] == NULL)
1087  return;
1088  comp = sorts[0]->psvi;
1089  if (comp == NULL)
1090  return;
1091 
1092  list = ctxt->nodeList;
1093  if ((list == NULL) || (list->nodeNr <= 1))
1094  return; /* nothing to do */
1095 
1096  for (j = 0; j < nbsorts; j++) {
1097  comp = sorts[j]->psvi;
1098  tempstype[j] = 0;
1099  if ((comp->stype == NULL) && (comp->has_stype != 0)) {
1100  comp->stype =
1101  xsltEvalAttrValueTemplate(ctxt, sorts[j],
1102  (const xmlChar *) "data-type",
1103  XSLT_NAMESPACE);
1104  if (comp->stype != NULL) {
1105  tempstype[j] = 1;
1106  if (xmlStrEqual(comp->stype, (const xmlChar *) "text"))
1107  comp->number = 0;
1108  else if (xmlStrEqual(comp->stype, (const xmlChar *) "number"))
1109  comp->number = 1;
1110  else {
1111  xsltTransformError(ctxt, NULL, sorts[j],
1112  "xsltDoSortFunction: no support for data-type = %s\n",
1113  comp->stype);
1114  comp->number = 0; /* use default */
1115  }
1116  }
1117  }
1118  temporder[j] = 0;
1119  if ((comp->order == NULL) && (comp->has_order != 0)) {
1120  comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j],
1121  (const xmlChar *) "order",
1122  XSLT_NAMESPACE);
1123  if (comp->order != NULL) {
1124  temporder[j] = 1;
1125  if (xmlStrEqual(comp->order, (const xmlChar *) "ascending"))
1126  comp->descending = 0;
1127  else if (xmlStrEqual(comp->order,
1128  (const xmlChar *) "descending"))
1129  comp->descending = 1;
1130  else {
1131  xsltTransformError(ctxt, NULL, sorts[j],
1132  "xsltDoSortFunction: invalid value %s for order\n",
1133  comp->order);
1134  comp->descending = 0; /* use default */
1135  }
1136  }
1137  }
1138  }
1139 
1140  len = list->nodeNr;
1141 
1142  resultsTab[0] = xsltComputeSortResult(ctxt, sorts[0]);
1143  for (i = 1;i < XSLT_MAX_SORT;i++)
1144  resultsTab[i] = NULL;
1145 
1146  results = resultsTab[0];
1147 
1148  comp = sorts[0]->psvi;
1149  descending = comp->descending;
1150  number = comp->number;
1151  if (results == NULL)
1152  return;
1153 
1154  /* Shell's sort of node-set */
1155  for (incr = len / 2; incr > 0; incr /= 2) {
1156  for (i = incr; i < len; i++) {
1157  j = i - incr;
1158  if (results[i] == NULL)
1159  continue;
1160 
1161  while (j >= 0) {
1162  if (results[j] == NULL)
1163  tst = 1;
1164  else {
1165  if (number) {
1166  /* We make NaN smaller than number in accordance
1167  with XSLT spec */
1168  if (xmlXPathIsNaN(results[j]->floatval)) {
1169  if (xmlXPathIsNaN(results[j + incr]->floatval))
1170  tst = 0;
1171  else
1172  tst = -1;
1173  } else if (xmlXPathIsNaN(results[j + incr]->floatval))
1174  tst = 1;
1175  else if (results[j]->floatval ==
1176  results[j + incr]->floatval)
1177  tst = 0;
1178  else if (results[j]->floatval >
1179  results[j + incr]->floatval)
1180  tst = 1;
1181  else tst = -1;
1182  } else if(comp->locale != (xsltLocale)0) {
1183  tst = xsltLocaleStrcmp(
1184  comp->locale,
1185  (xsltLocaleChar *) results[j]->stringval,
1186  (xsltLocaleChar *) results[j + incr]->stringval);
1187  } else {
1188  tst = xmlStrcmp(results[j]->stringval,
1189  results[j + incr]->stringval);
1190  }
1191  if (descending)
1192  tst = -tst;
1193  }
1194  if (tst == 0) {
1195  /*
1196  * Okay we need to use multi level sorts
1197  */
1198  depth = 1;
1199  while (depth < nbsorts) {
1200  if (sorts[depth] == NULL)
1201  break;
1202  comp = sorts[depth]->psvi;
1203  if (comp == NULL)
1204  break;
1205  desc = comp->descending;
1206  numb = comp->number;
1207 
1208  /*
1209  * Compute the result of the next level for the
1210  * full set, this might be optimized ... or not
1211  */
1212  if (resultsTab[depth] == NULL)
1213  resultsTab[depth] = xsltComputeSortResult(ctxt,
1214  sorts[depth]);
1215  res = resultsTab[depth];
1216  if (res == NULL)
1217  break;
1218  if (res[j] == NULL) {
1219  if (res[j+incr] != NULL)
1220  tst = 1;
1221  } else if (res[j+incr] == NULL) {
1222  tst = -1;
1223  } else {
1224  if (numb) {
1225  /* We make NaN smaller than number in
1226  accordance with XSLT spec */
1227  if (xmlXPathIsNaN(res[j]->floatval)) {
1228  if (xmlXPathIsNaN(res[j +
1229  incr]->floatval))
1230  tst = 0;
1231  else
1232  tst = -1;
1233  } else if (xmlXPathIsNaN(res[j + incr]->
1234  floatval))
1235  tst = 1;
1236  else if (res[j]->floatval == res[j + incr]->
1237  floatval)
1238  tst = 0;
1239  else if (res[j]->floatval >
1240  res[j + incr]->floatval)
1241  tst = 1;
1242  else tst = -1;
1243  } else if(comp->locale != (xsltLocale)0) {
1244  tst = xsltLocaleStrcmp(
1245  comp->locale,
1246  (xsltLocaleChar *) res[j]->stringval,
1247  (xsltLocaleChar *) res[j + incr]->stringval);
1248  } else {
1249  tst = xmlStrcmp(res[j]->stringval,
1250  res[j + incr]->stringval);
1251  }
1252  if (desc)
1253  tst = -tst;
1254  }
1255 
1256  /*
1257  * if we still can't differenciate at this level
1258  * try one level deeper.
1259  */
1260  if (tst != 0)
1261  break;
1262  depth++;
1263  }
1264  }
1265  if (tst == 0) {
1266  tst = results[j]->index > results[j + incr]->index;
1267  }
1268  if (tst > 0) {
1269  tmp = results[j];
1270  results[j] = results[j + incr];
1271  results[j + incr] = tmp;
1272  node = list->nodeTab[j];
1273  list->nodeTab[j] = list->nodeTab[j + incr];
1274  list->nodeTab[j + incr] = node;
1275  depth = 1;
1276  while (depth < nbsorts) {
1277  if (sorts[depth] == NULL)
1278  break;
1279  if (resultsTab[depth] == NULL)
1280  break;
1281  res = resultsTab[depth];
1282  tmp = res[j];
1283  res[j] = res[j + incr];
1284  res[j + incr] = tmp;
1285  depth++;
1286  }
1287  j -= incr;
1288  } else
1289  break;
1290  }
1291  }
1292  }
1293 
1294  for (j = 0; j < nbsorts; j++) {
1295  comp = sorts[j]->psvi;
1296  if (tempstype[j] == 1) {
1297  /* The data-type needs to be recomputed each time */
1298  xmlFree((void *)(comp->stype));
1299  comp->stype = NULL;
1300  }
1301  if (temporder[j] == 1) {
1302  /* The order needs to be recomputed each time */
1303  xmlFree((void *)(comp->order));
1304  comp->order = NULL;
1305  }
1306  if (resultsTab[j] != NULL) {
1307  for (i = 0;i < len;i++)
1308  xmlXPathFreeObject(resultsTab[j][i]);
1309  xmlFree(resultsTab[j]);
1310  }
1311  }
1312 }
xmlNodeSetPtr nodeList
void * psvi
Definition: tree.h:505
int xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2)
Definition: xsltlocale.c:422
#define XSLT_NAMESPACE
Definition: xslt.h:46
const xmlChar * order
xmlChar * xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst, const xmlChar *name, const xmlChar *ns)
Definition: templates.c:384
struct node node
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
#define XSLT_MAX_SORT
static size_t double number
Definition: printf.c:64
const xmlChar * stype
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
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
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlChar xsltLocaleChar
Definition: xsltlocale.h:64
struct _test_info results[8]
Definition: SetCursorPos.c:29
Definition: tree.h:489
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
xmlXPathObjectPtr * xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort)
Definition: xsltutils.c:937
GLuint res
Definition: glext.h:9613
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Definition: dlist.c:348
XMLPUBFUN int XMLCALL xmlStrcmp(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:132

Referenced by xsltSetSortFunc().

◆ xsltDocumentSortFunction()

void xsltDocumentSortFunction ( xmlNodeSetPtr  list)

xsltDocumentSortFunction: @list: the node set

reorder the current node list @list accordingly to the document order This function is slow, obsolete and should not be used anymore.

Definition at line 903 of file xsltutils.c.

903  {
904  int i, j;
905  int len, tst;
907 
908  if (list == NULL)
909  return;
910  len = list->nodeNr;
911  if (len <= 1)
912  return;
913  /* TODO: sort is really not optimized, does it needs to ? */
914  for (i = 0;i < len -1;i++) {
915  for (j = i + 1; j < len; j++) {
916  tst = xmlXPathCmpNodes(list->nodeTab[i], list->nodeTab[j]);
917  if (tst == -1) {
918  node = list->nodeTab[i];
919  list->nodeTab[i] = list->nodeTab[j];
920  list->nodeTab[j] = node;
921  }
922  }
923  }
924 }
struct node node
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
smooth NULL
Definition: ftsmooth.c:416
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
Definition: tree.h:489
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
Definition: dlist.c:348

◆ xsltDoSortFunction()

void xsltDoSortFunction ( xsltTransformContextPtr  ctxt,
xmlNodePtr sorts,
int  nbsorts 
)

xsltDoSortFunction: @ctxt: a XSLT process context @sorts: array of sort nodes @nbsorts: the number of sorts in the array

reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes. This is a wrapper function, the actual function used is specified using xsltSetCtxtSortFunc() to set the context specific sort function, or xsltSetSortFunc() to set the global sort function. If a sort function is set on the context, this will get called. Otherwise the global sort function is called.

Definition at line 1332 of file xsltutils.c.

1334 {
1335  if (ctxt->sortfunc != NULL)
1336  (ctxt->sortfunc)(ctxt, sorts, nbsorts);
1337  else if (xsltSortFunction != NULL)
1338  xsltSortFunction(ctxt, sorts, nbsorts);
1339 }
static xsltSortFunc xsltSortFunction
Definition: xsltutils.c:1315
smooth NULL
Definition: ftsmooth.c:416

Referenced by xsltApplyTemplates(), and xsltForEach().

◆ xsltGetCNsProp()

const xmlChar* xsltGetCNsProp ( xsltStylesheetPtr  style,
xmlNodePtr  node,
const xmlChar name,
const xmlChar nameSpace 
)

Definition at line 52 of file xsltutils.c.

53  {
54  xmlAttrPtr prop;
55  xmlDocPtr doc;
56  xmlNsPtr ns;
57  xmlChar *tmp;
58  const xmlChar *ret;
59 
60  if ((node == NULL) || (style == NULL) || (style->dict == NULL))
61  return(NULL);
62 
63  if (nameSpace == NULL)
64  return xmlGetProp(node, name);
65 
66  if (node->type == XML_NAMESPACE_DECL)
67  return(NULL);
68  if (node->type == XML_ELEMENT_NODE)
69  prop = node->properties;
70  else
71  prop = NULL;
72  while (prop != NULL) {
73  /*
74  * One need to have
75  * - same attribute names
76  * - and the attribute carrying that namespace
77  */
78  if ((xmlStrEqual(prop->name, name)) &&
79  (((prop->ns == NULL) && (node->ns != NULL) &&
80  (xmlStrEqual(node->ns->href, nameSpace))) ||
81  ((prop->ns != NULL) &&
82  (xmlStrEqual(prop->ns->href, nameSpace))))) {
83 
84  tmp = xmlNodeListGetString(node->doc, prop->children, 1);
85  if (tmp == NULL)
86  ret = xmlDictLookup(style->dict, BAD_CAST "", 0);
87  else {
88  ret = xmlDictLookup(style->dict, tmp, -1);
89  xmlFree(tmp);
90  }
91  return ret;
92  }
93  prop = prop->next;
94  }
95  tmp = NULL;
96  /*
97  * Check if there is a default declaration in the internal
98  * or external subsets
99  */
100  doc = node->doc;
101  if (doc != NULL) {
102  if (doc->intSubset != NULL) {
103  xmlAttributePtr attrDecl;
104 
105  attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
106  if ((attrDecl == NULL) && (doc->extSubset != NULL))
107  attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
108 
109  if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
110  /*
111  * The DTD declaration only allows a prefix search
112  */
113  ns = xmlSearchNs(doc, node, attrDecl->prefix);
114  if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace)))
115  return(xmlDictLookup(style->dict,
116  attrDecl->defaultValue, -1));
117  }
118  }
119  }
120  return(NULL);
121 }
const xmlChar * prefix
Definition: tree.h:269
xmlNs * ns
Definition: tree.h:444
struct _xmlDtd * intSubset
Definition: tree.h:570
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlGetProp(const xmlNode *node, const xmlChar *name)
struct _xmlAttr * next
Definition: tree.h:441
struct _xmlNode * children
Definition: tree.h:438
XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name)
Definition: valid.c:3298
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
const xmlChar * defaultValue
Definition: tree.h:267
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
XMLPUBFUN xmlChar *XMLCALL xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
int ret
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: tree.h:551
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: tree.h:434
Definition: name.c:36
const xmlChar * name
Definition: tree.h:437
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
const xmlChar * href
Definition: tree.h:392
Definition: dlist.c:348

Referenced by xsltApplyTemplatesComp(), xsltCopyComp(), xsltCopyOfComp(), xsltForEachComp(), xsltGetQNameProperty(), xsltIfComp(), xsltNumberComp(), xsltParamComp(), xsltSortComp(), xsltTextComp(), xsltValueOfComp(), xsltVariableComp(), xsltWhenComp(), and xsltWithParamComp().

◆ xsltGetDebuggerStatus()

int xsltGetDebuggerStatus ( void  )

xsltGetDebuggerStatus:

Get xslDebugStatus.

Returns the value of xslDebugStatus.

Definition at line 2379 of file xsltutils.c.

2380 {
2381  return(xslDebugStatus);
2382 }
int xslDebugStatus
Definition: xsltutils.c:2357

◆ xsltGetNsProp()

xmlChar* xsltGetNsProp ( xmlNodePtr  node,
const xmlChar name,
const xmlChar nameSpace 
)

Definition at line 142 of file xsltutils.c.

142  {
143  xmlAttrPtr prop;
144  xmlDocPtr doc;
145  xmlNsPtr ns;
146 
147  if (node == NULL)
148  return(NULL);
149 
150  if (nameSpace == NULL)
151  return xmlGetProp(node, name);
152 
153  if (node->type == XML_NAMESPACE_DECL)
154  return(NULL);
155  if (node->type == XML_ELEMENT_NODE)
156  prop = node->properties;
157  else
158  prop = NULL;
159  /*
160  * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former
161  * is not namespace-aware and will return an attribute with equal
162  * name regardless of its namespace.
163  * Example:
164  * <xsl:element foo:name="myName"/>
165  * So this would return "myName" even if an attribute @name
166  * in the XSLT was requested.
167  */
168  while (prop != NULL) {
169  /*
170  * One need to have
171  * - same attribute names
172  * - and the attribute carrying that namespace
173  */
174  if ((xmlStrEqual(prop->name, name)) &&
175  (((prop->ns == NULL) && (node->ns != NULL) &&
176  (xmlStrEqual(node->ns->href, nameSpace))) ||
177  ((prop->ns != NULL) &&
178  (xmlStrEqual(prop->ns->href, nameSpace))))) {
179  xmlChar *ret;
180 
181  ret = xmlNodeListGetString(node->doc, prop->children, 1);
182  if (ret == NULL) return(xmlStrdup((xmlChar *)""));
183  return(ret);
184  }
185  prop = prop->next;
186  }
187 
188  /*
189  * Check if there is a default declaration in the internal
190  * or external subsets
191  */
192  doc = node->doc;
193  if (doc != NULL) {
194  if (doc->intSubset != NULL) {
195  xmlAttributePtr attrDecl;
196 
197  attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
198  if ((attrDecl == NULL) && (doc->extSubset != NULL))
199  attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
200 
201  if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
202  /*
203  * The DTD declaration only allows a prefix search
204  */
205  ns = xmlSearchNs(doc, node, attrDecl->prefix);
206  if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace)))
207  return(xmlStrdup(attrDecl->defaultValue));
208  }
209  }
210  }
211  return(NULL);
212 }
const xmlChar * prefix
Definition: tree.h:269
xmlNs * ns
Definition: tree.h:444
struct _xmlDtd * intSubset
Definition: tree.h:570
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlGetProp(const xmlNode *node, const xmlChar *name)
struct _xmlAttr * next
Definition: tree.h:441
struct _xmlNode * children
Definition: tree.h:438
XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name)
Definition: valid.c:3298
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
const xmlChar * defaultValue
Definition: tree.h:267
XMLPUBFUN xmlChar *XMLCALL xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
int ret
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: tree.h:551
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: tree.h:434
Definition: name.c:36
const xmlChar * name
Definition: tree.h:437
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
const xmlChar * href
Definition: tree.h:392
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: dlist.c:348

Referenced by xsltEvalAttrValueTemplate(), and xsltEvalStaticAttrValueTemplate().

◆ xsltGetProfileInformation()

xmlDocPtr xsltGetProfileInformation ( xsltTransformContextPtr  ctxt)

xsltGetProfileInformation: @ctxt: a transformation context

This function should be called after the transformation completed to extract template processing profiling information if available. The information is returned as an XML document tree like <?xml version="1.0"?> <profile> <template rank="1" match="*" name="" mode="" calls="6" time="48" average="8"> <template rank="2" match="item2|item3" name="" mode="" calls="10" time="30" average="3"> <template rank="3" match="item1" name="" mode="" calls="5" time="17" average="3"> </profile> The caller will need to free up the returned tree with xmlFreeDoc()

Returns the xmlDocPtr corresponding to the result or NULL if not available.

Definition at line 2157 of file xsltutils.c.

2158 {
2159  xmlDocPtr ret = NULL;
2161  char buf[100];
2162 
2165  xsltTemplatePtr templ;
2166  int nb = 0, max = 0, i, j;
2167 
2168  if (!ctxt)
2169  return NULL;
2170 
2171  if (!ctxt->profile)
2172  return NULL;
2173 
2174  nb = 0;
2175  max = 10000;
2176  templates =
2178  if (templates == NULL)
2179  return NULL;
2180 
2181  /*
2182  * collect all the templates in an array
2183  */
2184  style = ctxt->style;
2185  while (style != NULL) {
2186  templ = style->templates;
2187  while (templ != NULL) {
2188  if (nb >= max)
2189  break;
2190 
2191  if (templ->nbCalls > 0)
2192  templates[nb++] = templ;
2193  templ = templ->next;
2194  }
2195 
2197  }
2198 
2199  /*
2200  * Sort the array by time spent
2201  */
2202  for (i = 0; i < nb - 1; i++) {
2203  for (j = i + 1; j < nb; j++) {
2204  if ((templates[i]->time <= templates[j]->time) ||
2205  ((templates[i]->time == templates[j]->time) &&
2206  (templates[i]->nbCalls <= templates[j]->nbCalls))) {
2207  templ = templates[j];
2208  templates[j] = templates[i];
2209  templates[i] = templ;
2210  }
2211  }
2212  }
2213 
2214  /*
2215  * Generate a document corresponding to the results.
2216  */
2217  ret = xmlNewDoc(BAD_CAST "1.0");
2218  root = xmlNewDocNode(ret, NULL, BAD_CAST "profile", NULL);
2219  xmlDocSetRootElement(ret, root);
2220 
2221  for (i = 0; i < nb; i++) {
2222  child = xmlNewChild(root, NULL, BAD_CAST "template", NULL);
2223  snprintf(buf, sizeof(buf), "%d", i + 1);
2224  xmlSetProp(child, BAD_CAST "rank", BAD_CAST buf);
2225  xmlSetProp(child, BAD_CAST "match", BAD_CAST templates[i]->match);
2226  xmlSetProp(child, BAD_CAST "name", BAD_CAST templates[i]->name);
2227  xmlSetProp(child, BAD_CAST "mode", BAD_CAST templates[i]->mode);
2228 
2229  snprintf(buf, sizeof(buf), "%d", templates[i]->nbCalls);
2230  xmlSetProp(child, BAD_CAST "calls", BAD_CAST buf);
2231 
2232  snprintf(buf, sizeof(buf), "%ld", templates[i]->time);
2233  xmlSetProp(child, BAD_CAST "time", BAD_CAST buf);
2234 
2235  snprintf(buf, sizeof(buf), "%ld", templates[i]->time / templates[i]->nbCalls);
2236  xmlSetProp(child, BAD_CAST "average", BAD_CAST buf);
2237  };
2238 
2239  xmlFree(templates);
2240 
2241  return ret;
2242 }
#define max(a, b)
Definition: svc.c:63
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: match.c:28
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
struct _root root
#define snprintf
Definition: wintirpc.h:48
__u16 time
Definition: mkdosfs.c:366
static HWND child
Definition: cursoricon.c:298
struct _xsltTemplate * next
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
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
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
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: tree.h:489
int ret
GLenum mode
Definition: glext.h:6217
xsltStylesheetPtr style
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content)
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
Definition: tree.h:551
Definition: name.c:36
char templates[]
Definition: meshbuilder.c:42
Arabic default style
Definition: afstyles.h:93
XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc(const xmlChar *version)
xsltStylesheet * xsltStylesheetPtr

◆ xsltGetQNameURI()

const xmlChar* xsltGetQNameURI ( xmlNodePtr  node,
xmlChar **  name 
)

Definition at line 753 of file xsltutils.c.

754 {
755  int len = 0;
756  xmlChar *qname;
757  xmlNsPtr ns;
758 
759  if (name == NULL)
760  return(NULL);
761  qname = *name;
762  if ((qname == NULL) || (*qname == 0))
763  return(NULL);
764  if (node == NULL) {
766  "QName: no element for namespace lookup %s\n",
767  qname);
768  xmlFree(qname);
769  *name = NULL;
770  return(NULL);
771  }
772 
773  /* nasty but valid */
774  if (qname[0] == ':')
775  return(NULL);
776 
777  /*
778  * we are not trying to validate but just to cut, and yes it will
779  * work even if this is a set of UTF-8 encoded chars
780  */
781  while ((qname[len] != 0) && (qname[len] != ':'))
782  len++;
783 
784  if (qname[len] == 0)
785  return(NULL);
786 
787  /*
788  * handle xml: separately, this one is magical
789  */
790  if ((qname[0] == 'x') && (qname[1] == 'm') &&
791  (qname[2] == 'l') && (qname[3] == ':')) {
792  if (qname[4] == 0)
793  return(NULL);
794  *name = xmlStrdup(&qname[4]);
795  xmlFree(qname);
796  return(XML_XML_NAMESPACE);
797  }
798 
799  qname[len] = 0;
800  ns = xmlSearchNs(node->doc, node, qname);
801  if (ns == NULL) {
803  "%s:%s : no namespace bound to prefix %s\n",
804  qname, &qname[len + 1], qname);
805  *name = NULL;
806  xmlFree(qname);
807  return(NULL);
808  }
809  *name = xmlStrdup(&qname[len + 1]);
810  xmlFree(qname);
811  return(ns->href);
812 }
Definition: tree.h:389
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
#define XML_XML_NAMESPACE
Definition: tree.h:140
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: name.c:36
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: dlist.c:348
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by xsltCompileStepPattern(), xsltDocumentElem(), xsltParseStylesheetDecimalFormat(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetStripSpace(), and xsltParseStylesheetTemplate().

◆ xsltGetQNameURI2()

const xmlChar* xsltGetQNameURI2 ( xsltStylesheetPtr  style,
xmlNodePtr  node,
const xmlChar **  name 
)

Definition at line 827 of file xsltutils.c.

828  {
829  int len = 0;
830  xmlChar *qname;
831  xmlNsPtr ns;
832 
833  if (name == NULL)
834  return(NULL);
835  qname = (xmlChar *)*name;
836  if ((qname == NULL) || (*qname == 0))
837  return(NULL);
838  if (node == NULL) {
840  "QName: no element for namespace lookup %s\n",
841  qname);
842  *name = NULL;
843  return(NULL);
844  }
845 
846  /*
847  * we are not trying to validate but just to cut, and yes it will
848  * work even if this is a set of UTF-8 encoded chars
849  */
850  while ((qname[len] != 0) && (qname[len] != ':'))
851  len++;
852 
853  if (qname[len] == 0)
854  return(NULL);
855 
856  /*
857  * handle xml: separately, this one is magical
858  */
859  if ((qname[0] == 'x') && (qname[1] == 'm') &&
860  (qname[2] == 'l') && (qname[3] == ':')) {
861  if (qname[4] == 0)
862  return(NULL);
863  *name = xmlDictLookup(style->dict, &qname[4], -1);
864  return(XML_XML_NAMESPACE);
865  }
866 
867  qname = xmlStrndup(*name, len);
868  ns = xmlSearchNs(node->doc, node, qname);
869  if (ns == NULL) {
870  if (style) {
872  "No namespace bound to prefix '%s'.\n",
873  qname);
874  style->errors++;
875  } else {
877  "%s : no namespace bound to prefix %s\n",
878  *name, qname);
879  }
880  *name = NULL;
881  xmlFree(qname);
882  return(NULL);
883  }
884  *name = xmlDictLookup(style->dict, (*name)+len+1, -1);
885  xmlFree(qname);
886  return(ns->href);
887 }
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
#define XML_XML_NAMESPACE
Definition: tree.h:140
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: name.c:36
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93
Definition: dlist.c:348

Referenced by xsltGetQNameProperty().

◆ xsltGetUTF8Char()

int xsltGetUTF8Char ( const unsigned char utf,
int len 
)

xsltGetUTF8Char: @utf: a sequence of UTF-8 encoded bytes @len: a pointer to @bytes len

Read one UTF8 Char from @utf Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately and use the original API

Returns the char value or -1 in case of error and update @len with the number of bytes used

Definition at line 227 of file xsltutils.c.

227  {
228  unsigned int c;
229 
230  if (utf == NULL)
231  goto error;
232  if (len == NULL)
233  goto error;
234  if (*len < 1)
235  goto error;
236 
237  c = utf[0];
238  if (c & 0x80) {
239  if (*len < 2)
240  goto error;
241  if ((utf[1] & 0xc0) != 0x80)
242  goto error;
243  if ((c & 0xe0) == 0xe0) {
244  if (*len < 3)
245  goto error;
246  if ((utf[2] & 0xc0) != 0x80)
247  goto error;
248  if ((c & 0xf0) == 0xf0) {
249  if (*len < 4)
250  goto error;
251  if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
252  goto error;
253  *len = 4;
254  /* 4-byte code */
255  c = (utf[0] & 0x7) << 18;
256  c |= (utf[1] & 0x3f) << 12;
257  c |= (utf[2] & 0x3f) << 6;
258  c |= utf[3] & 0x3f;
259  } else {
260  /* 3-byte code */
261  *len = 3;
262  c = (utf[0] & 0xf) << 12;
263  c |= (utf[1] & 0x3f) << 6;
264  c |= utf[2] & 0x3f;
265  }
266  } else {
267  /* 2-byte code */
268  *len = 2;
269  c = (utf[0] & 0x1f) << 6;
270  c |= utf[1] & 0x3f;
271  }
272  } else {
273  /* 1-byte code */
274  *len = 1;
275  }
276  return(c);
277 
278 error:
279  if (len != NULL)
280  *len = 0;
281  return(-1);
282 }
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
#define c
Definition: ke_i.h:80

Referenced by xsltFormatNumberConversion(), and xsltNumberComp().

◆ xsltMessage()

void xsltMessage ( xsltTransformContextPtr  ctxt,
xmlNodePtr  node,
xmlNodePtr  inst 
)

xsltMessage: @ctxt: an XSLT processing context @node: The current node @inst: The node containing the message instruction

Process and xsl:message construct

Definition at line 408 of file xsltutils.c.

408  {
410  void *errctx = xsltGenericErrorContext;
411  xmlChar *prop, *message;
412  int terminate = 0;
413 
414  if ((ctxt == NULL) || (inst == NULL))
415  return;
416 
417  if (ctxt->error != NULL) {
418  error = ctxt->error;
419  errctx = ctxt->errctx;
420  }
421 
422  prop = xmlGetNsProp(inst, (const xmlChar *)"terminate", NULL);
423  if (prop != NULL) {
424  if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
425  terminate = 1;
426  } else if (xmlStrEqual(prop, (const xmlChar *)"no")) {
427  terminate = 0;
428  } else {
429  xsltTransformError(ctxt, NULL, inst,
430  "xsl:message : terminate expecting 'yes' or 'no'\n");
431  }
432  xmlFree(prop);
433  }
434  message = xsltEvalTemplateString(ctxt, node, inst);
435  if (message != NULL) {
436  int len = xmlStrlen(message);
437 
438  error(errctx, "%s", (const char *)message);
439  if ((len > 0) && (message[len - 1] != '\n'))
440  error(errctx, "\n");
441  xmlFree(message);
442  }
443  if (terminate)
444  ctxt->state = XSLT_STATE_STOPPED;
445 }
Definition: tftpd.h:59
#define error(str)
Definition: mkdosfs.c:1605
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:422
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
xsltTransformState state
smooth NULL
Definition: ftsmooth.c:416
void MSVCRT() terminate()
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
void * xsltGenericErrorContext
Definition: xsltutils.c:503
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
xmlGenericErrorFunc error
xmlChar * xsltEvalTemplateString(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst)
Definition: templates.c:189
void(XMLCDECL * xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:845
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Definition: dlist.c:348

Referenced by xsltApplySequenceConstructor(), and xsltMessageWrapper().

◆ xsltPrintErrorContext()

void xsltPrintErrorContext ( xsltTransformContextPtr  ctxt,
xsltStylesheetPtr  style,
xmlNodePtr  node 
)

xsltPrintErrorContext: @ctxt: the transformation context @style: the stylesheet @node: the current node being processed

Display the context of an error.

Definition at line 583 of file xsltutils.c.

584  {
585  int line = 0;
586  const xmlChar *file = NULL;
587  const xmlChar *name = NULL;
588  const char *type = "error";
590  void *errctx = xsltGenericErrorContext;
591 
592  if (ctxt != NULL) {
593  if (ctxt->state == XSLT_STATE_OK)
594  ctxt->state = XSLT_STATE_ERROR;
595  if (ctxt->error != NULL) {
596  error = ctxt->error;
597  errctx = ctxt->errctx;
598  }
599  }
600  if ((node == NULL) && (ctxt != NULL))
601  node = ctxt->inst;
602 
603  if (node != NULL) {
604  if ((node->type == XML_DOCUMENT_NODE) ||
605  (node->type == XML_HTML_DOCUMENT_NODE)) {
606  xmlDocPtr doc = (xmlDocPtr) node;
607 
608  file = doc->URL;
609  } else {
611  if ((node->doc != NULL) && (node->doc->URL != NULL))
612  file = node->doc->URL;
613  if (node->name != NULL)
614  name = node->name;
615  }
616  }
617 
618  if (ctxt != NULL)
619  type = "runtime error";
620  else if (style != NULL) {
621 #ifdef XSLT_REFACTORED
622  if (XSLT_CCTXT(style)->errSeverity == XSLT_ERROR_SEVERITY_WARNING)
623  type = "compilation warning";
624  else
625  type = "compilation error";
626 #else
627  type = "compilation error";
628 #endif
629  }
630 
631  if ((file != NULL) && (line != 0) && (name != NULL))
632  error(errctx, "%s: file %s line %d element %s\n",
633  type, file, line, name);
634  else if ((file != NULL) && (name != NULL))
635  error(errctx, "%s: file %s element %s\n", type, file, name);
636  else if ((file != NULL) && (line != 0))
637  error(errctx, "%s: file %s line %d\n", type, file, line);
638  else if (file != NULL)
639  error(errctx, "%s: file %s\n", type, file);
640  else if (name != NULL)
641  error(errctx, "%s: element %s\n", type, name);
642  else
643  error(errctx, "%s\n", type);
644 }
const xmlChar * URL
Definition: tree.h:577
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
xsltTransformState state
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
XMLPUBFUN long XMLCALL xmlGetLineNo(const xmlNode *node)
void * xsltGenericErrorContext
Definition: xsltutils.c:503
unsigned char xmlChar
Definition: xmlstring.h:28
xmlDoc * xmlDocPtr
Definition: tree.h:550
xmlGenericErrorFunc error
Definition: tree.h:551
Definition: name.c:36
void(XMLCDECL * xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:845
Arabic default style
Definition: afstyles.h:93
Definition: dlist.c:348
Definition: fci.c:126

Referenced by xsltTransformError().

◆ xsltSaveProfiling()

void xsltSaveProfiling ( xsltTransformContextPtr  ctxt,
FILE output 
)

xsltSaveProfiling: @ctxt: an XSLT context @output: a FILE * for saving the information

Save the profiling information on @output

Definition at line 1937 of file xsltutils.c.

1937  {
1938  int nb, i,j,k,l;
1939  int max;
1940  int total;
1941  unsigned long totalt;
1944  xsltTemplatePtr templ1,templ2;
1945  int *childt;
1946 
1947  if ((output == NULL) || (ctxt == NULL))
1948  return;
1949  if (ctxt->profile == 0)
1950  return;
1951 
1952  nb = 0;
1953  max = MAX_TEMPLATES;
1954  templates = xmlMalloc(max * sizeof(xsltTemplatePtr));
1955  if (templates == NULL)
1956  return;
1957 
1958  style = ctxt->style;
1959  while (style != NULL) {
1960  templ1 = style->templates;
1961  while (templ1 != NULL) {
1962  if (nb >= max)
1963  break;
1964 
1965  if (templ1->nbCalls > 0)
1966  templates[nb++] = templ1;
1967  templ1 = templ1->next;
1968  }
1969 
1971  }
1972 
1973  for (i = 0;i < nb -1;i++) {
1974  for (j = i + 1; j < nb; j++) {
1975  if ((templates[i]->time <= templates[j]->time) ||
1976  ((templates[i]->time == templates[j]->time) &&
1977  (templates[i]->nbCalls <= templates[j]->nbCalls))) {
1978  templ1 = templates[j];
1979  templates[j] = templates[i];
1980  templates[i] = templ1;
1981  }
1982  }
1983  }
1984 
1985 
1986  /* print flat profile */
1987 
1988  fprintf(output, "%6s%20s%20s%10s Calls Tot 100us Avg\n\n",
1989  "number", "match", "name", "mode");
1990  total = 0;
1991  totalt = 0;
1992  for (i = 0;i < nb;i++) {
1993  templ1 = templates[i];
1994  fprintf(output, "%5d ", i);
1995  if (templ1->match != NULL) {
1996  if (xmlStrlen(templ1->match) > 20)
1997  fprintf(output, "%s\n%26s", templ1->match, "");
1998  else
1999  fprintf(output, "%20s", templ1->match);
2000  } else {
2001  fprintf(output, "%20s", "");
2002  }
2003  if (templ1->name != NULL) {
2004  if (xmlStrlen(templ1->name) > 20)
2005  fprintf(output, "%s\n%46s", templ1->name, "");
2006  else
2007  fprintf(output, "%20s", templ1->name);
2008  } else {
2009  fprintf(output, "%20s", "");
2010  }
2011  if (templ1->mode != NULL) {
2012  if (xmlStrlen(templ1->mode) > 10)
2013  fprintf(output, "%s\n%56s", templ1->mode, "");
2014  else
2015  fprintf(output, "%10s", templ1->mode);
2016  } else {
2017  fprintf(output, "%10s", "");
2018  }
2019  fprintf(output, " %6d", templ1->nbCalls);
2020  fprintf(output, " %6ld %6ld\n", templ1->time,
2021  templ1->time / templ1->nbCalls);
2022  total += templ1->nbCalls;
2023  totalt += templ1->time;
2024  }
2025  fprintf(output, "\n%30s%26s %6d %6ld\n", "Total", "", total, totalt);
2026 
2027 
2028  /* print call graph */
2029 
2030  childt = xmlMalloc((nb + 1) * sizeof(int));
2031  if (childt == NULL)
2032  return;
2033 
2034  /* precalculate children times */
2035  for (i = 0; i < nb; i++) {
2036  templ1 = templates[i];
2037 
2038  childt[i] = 0;
2039  for (k = 0; k < nb; k++) {
2040  templ2 = templates[k];
2041  for (l = 0; l < templ2->templNr; l++) {
2042  if (templ2->templCalledTab[l] == templ1) {
2043  childt[i] +=templ2->time;
2044  }
2045  }
2046  }
2047  }
2048  childt[i] = 0;
2049 
2050  fprintf(output, "\nindex %% time self children called name\n");
2051 
2052  for (i = 0; i < nb; i++) {
2053  char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20];
2054  unsigned long t;
2055 
2056  templ1 = templates[i];
2057  /* callers */
2058  for (j = 0; j < templ1->templNr; j++) {
2059  templ2 = templ1->templCalledTab[j];
2060  for (k = 0; k < nb; k++) {
2061  if (templates[k] == templ2)
2062  break;
2063  }
2064  t=templ2?templ2->time:totalt;
2065  snprintf(times_str,sizeof(times_str),"%8.3f",(float)t/XSLT_TIMESTAMP_TICS_PER_SEC);
2066  snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
2067  snprintf(called_str,sizeof(called_str),"%6d/%d",
2068  templ1->templCountTab[j], /* number of times caller calls 'this' */
2069  templ1->nbCalls); /* total number of calls to 'this' */
2070 
2071  fprintf(output, " %-8s %-8s %-12s %s [%d]\n",
2072  times_str,timec_str,called_str,
2073  (templ2?(templ2->name?(char *)templ2->name:pretty_templ_match(templ2)):"-"),k);
2074  }
2075  /* this */
2076  snprintf(ix_str,sizeof(ix_str),"[%d]",i);
2077  snprintf(timep_str,sizeof(timep_str),"%6.2f",(float)templ1->time*100.0/totalt);
2078  snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC);
2079  snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC);
2080  fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n",
2081  ix_str, timep_str,times_str,timec_str,
2082  templ1->nbCalls,
2083  templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i);
2084  /* callees
2085  * - go over templates[0..nb] and their templCalledTab[]
2086  * - print those where we in the the call-stack
2087  */
2088  total = 0;
2089  for (k = 0; k < nb; k++) {
2090  templ2 = templates[k];
2091  for (l = 0; l < templ2->templNr; l++) {
2092  if (templ2->templCalledTab[l] == templ1) {
2093  total+=templ2->templCountTab[l];
2094  }
2095  }
2096  }
2097  for (k = 0; k < nb; k++) {
2098  templ2 = templates[k];
2099  for (l = 0; l < templ2->templNr; l++) {
2100  if (templ2->templCalledTab[l] == templ1) {
2101  snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ2->time/XSLT_TIMESTAMP_TICS_PER_SEC);
2102  snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
2103  snprintf(called_str,sizeof(called_str),"%6d/%d",
2104  templ2->templCountTab[l], /* number of times 'this' calls callee */
2105  total); /* total number of calls from 'this' */
2106  fprintf(output, " %-8s %-8s %-12s %s [%d]\n",
2107  times_str,timec_str,called_str,
2108  templ2->name?(char *)templ2->name:pretty_templ_match(templ2),k);
2109  }
2110  }
2111  }
2112  fprintf(output, "-----------------------------------------------\n");
2113  }
2114 
2115  fprintf(output, "\f\nIndex by function name\n");
2116  for (i = 0; i < nb; i++) {
2117  templ1 = templates[i];
2118  fprintf(output, "[%d] %s (%s:%d)\n",
2119  i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1),
2120  templ1->style->doc->URL,templ1->elem->line);
2121  }
2122 
2123  fprintf(output, "\f\n");
2124  xmlFree(childt);
2125 
2126  xmlFree(templates);
2127 }
#define max(a, b)
Definition: svc.c:63
const xmlChar * mode
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
const xmlChar * name
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:422
xsltTemplatePtr * templCalledTab
GLdouble GLdouble t
Definition: gl.h:2047
xmlNodePtr elem
#define snprintf
Definition: wintirpc.h:48
#define XSLT_TIMESTAMP_TICS_PER_SEC
Definition: xsltutils.h:269
__u16 time
Definition: mkdosfs.c:366
struct _xsltTemplate * next
#define MAX_TEMPLATES
Definition: xsltutils.c:1927
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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
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
r l[0]
Definition: byte_order.h:167
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned long time
struct _xsltStylesheet * style
xsltStylesheetPtr style
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
static char * pretty_templ_match(xsltTemplatePtr templ)
Definition: xsltutils.c:1904
xmlChar * match
char templates[]
Definition: meshbuilder.c:42
Arabic default style
Definition: afstyles.h:93
int k
Definition: mpi.c:3369
unsigned short line
Definition: tree.h:506

Referenced by xsltApplyStylesheetInternal().

◆ xsltSaveResultTo()

int xsltSaveResultTo ( xmlOutputBufferPtr  buf,
xmlDocPtr  result,
xsltStylesheetPtr  style 
)

xsltSaveResultTo: @buf: an output buffer

Returns
: the result xmlDocPtr @style: the stylesheet

Save the result

Returns
obtained by applying the @style stylesheet to an I/O output channel @buf

Returns the number of byte written or -1 in case of failure.

Definition at line 1423 of file xsltutils.c.

1424  {
1425  const xmlChar *encoding;
1426  int base;
1427  const xmlChar *method;
1428  int indent;
1429 
1430  if ((buf == NULL) || (result == NULL) || (style == NULL))
1431  return(-1);
1432  if ((result->children == NULL) ||
1433  ((result->children->type == XML_DTD_NODE) &&
1434  (result->children->next == NULL)))
1435  return(0);
1436 
1437  if ((style->methodURI != NULL) &&
1438  ((style->method == NULL) ||
1439  (!xmlStrEqual(style->method, (const xmlChar *) "xhtml")))) {
1441  "xsltSaveResultTo : unknown output method\n");
1442  return(-1);
1443  }
1444 
1445  base = buf->written;
1446 
1450 
1451  if ((method == NULL) && (result->type == XML_HTML_DOCUMENT_NODE))
1452  method = (const xmlChar *) "html";
1453 
1454  if ((method != NULL) &&
1455  (xmlStrEqual(method, (const xmlChar *) "html"))) {
1456  if (encoding != NULL) {
1457  htmlSetMetaEncoding(result, (const xmlChar *) encoding);
1458  } else {
1459  htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8");
1460  }
1461  if (indent == -1)
1462  indent = 1;
1463  htmlDocContentDumpFormatOutput(buf, result, (const char *) encoding,
1464  indent);
1465  xmlOutputBufferFlush(buf);
1466  } else if ((method != NULL) &&
1467  (xmlStrEqual(method, (const xmlChar *) "xhtml"))) {
1468  if (encoding != NULL) {
1469  htmlSetMetaEncoding(result, (const xmlChar *) encoding);
1470  } else {
1471  htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8");
1472  }
1473  htmlDocContentDumpOutput(buf, result, (const char *) encoding);
1474  xmlOutputBufferFlush(buf);
1475  } else if ((method != NULL) &&
1476  (xmlStrEqual(method, (const xmlChar *) "text"))) {
1477  xmlNodePtr cur;
1478 
1479  cur = result->children;
1480  while (cur != NULL) {
1481  if (cur->type == XML_TEXT_NODE)
1482  xmlOutputBufferWriteString(buf, (const char *) cur->content);
1483 
1484  /*
1485  * Skip to next node
1486  */
1487  if (cur->children != NULL) {
1488  if ((cur->children->type != XML_ENTITY_DECL) &&
1489  (cur->children->type != XML_ENTITY_REF_NODE) &&
1490  (cur->children->type != XML_ENTITY_NODE)) {
1491  cur = cur->children;
1492  continue;
1493  }
1494  }
1495  if (cur->next != NULL) {
1496  cur = cur->next;
1497  continue;
1498  }
1499 
1500  do {
1501  cur = cur->parent;
1502  if (cur == NULL)
1503  break;
1504  if (cur == (xmlNodePtr) style->doc) {
1505  cur = NULL;
1506  break;
1507  }
1508  if (cur->next != NULL) {
1509  cur = cur->next;
1510  break;
1511  }
1512  } while (cur != NULL);
1513  }
1514  xmlOutputBufferFlush(buf);
1515  } else {
1516  int omitXmlDecl;
1517  int standalone;
1518 
1519  XSLT_GET_IMPORT_INT(omitXmlDecl, style, omitXmlDeclaration);
1520  XSLT_GET_IMPORT_INT(standalone, style, standalone);
1521 
1522  if (omitXmlDecl != 1) {
1523  xmlOutputBufferWriteString(buf, "<?xml version=");
1524  if (result->version != NULL) {
1525  xmlOutputBufferWriteString(buf, "\"");
1526  xmlOutputBufferWriteString(buf, (const char *)result->version);
1527  xmlOutputBufferWriteString(buf, "\"");
1528  } else
1529  xmlOutputBufferWriteString(buf, "\"1.0\"");
1530  if (encoding == NULL) {
1531  if (result->encoding != NULL)
1532  encoding = result->encoding;
1533  else if (result->charset != XML_CHAR_ENCODING_UTF8)
1534  encoding = (const xmlChar *)
1536  result->charset);
1537  }
1538  if (encoding != NULL) {
1539  xmlOutputBufferWriteString(buf, " encoding=");
1540  xmlOutputBufferWriteString(buf, "\"");
1541  xmlOutputBufferWriteString(buf, (const char *) encoding);
1542  xmlOutputBufferWriteString(buf, "\"");
1543  }
1544  switch (standalone) {
1545  case 0:
1546  xmlOutputBufferWriteString(buf, " standalone=\"no\"");
1547  break;
1548  case 1:
1549  xmlOutputBufferWriteString(buf, " standalone=\"yes\"");
1550  break;
1551  default:
1552  break;
1553  }
1554  xmlOutputBufferWriteString(buf, "?>\n");
1555  }
1556  if (result->children != NULL) {
1557  xmlNodePtr child = result->children;
1558 
1559  while (child != NULL) {
1560  xmlNodeDumpOutput(buf, result, child, 0, (indent == 1),
1561  (const char *) encoding);
1562  if (indent && ((child->type == XML_DTD_NODE) ||
1563  ((child->type == XML_COMMENT_NODE) &&
1564  (child->next != NULL))))
1565  xmlOutputBufferWriteString(buf, "\n");
1566  child = child->next;
1567  }
1568  if (indent)
1569  xmlOutputBufferWriteString(buf, "\n");
1570  }
1571  xmlOutputBufferFlush(buf);
1572  }
1573  return(buf->written - base);
1574 }
static const WCHAR indent[]
Definition: object.c:1156
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
xmlCharEncoding
Definition: encoding.h:58
XMLPUBFUN const char *XMLCALL xmlGetCharEncodingName(xmlCharEncoding enc)
Definition: encoding.c:1234
static HWND child
Definition: cursoricon.c:298
#define XSLT_GET_IMPORT_INT(res, style, name)
Definition: imports.h:40
GLuint base
Definition: 3dtext.c:35
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
smooth NULL
Definition: ftsmooth.c:416
struct _xmlNode * parent
Definition: tree.h:495
xmlChar * content
Definition: tree.h:502
method
Definition: dragdrop.c:53
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28
xmlElementType type
Definition: tree.h:491
ed encoding
Definition: write.c:2839
struct _xmlNode * next
Definition: tree.h:496
#define XSLT_GET_IMPORT_PTR(res, style, name)
Definition: imports.h:27
struct _xmlNode * children
Definition: tree.h:493
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
GLuint64EXT * result
Definition: glext.h:11304

Referenced by xsltRunStylesheetUser(), xsltSaveResultToFd(), xsltSaveResultToFile(), xsltSaveResultToFilename(), and xsltSaveResultToString().

◆ xsltSaveResultToFd()

int xsltSaveResultToFd ( int  fd,
xmlDocPtr  result,
xsltStylesheetPtr  style 
)

xsltSaveResultToFd: @fd: a file descriptor

Returns
: the result xmlDocPtr @style: the stylesheet

Save the result

Returns
obtained by applying the @style stylesheet to an open file descriptor This does not close the descriptor.

Returns the number of bytes written or -1 in case of failure.

Definition at line 1677 of file xsltutils.c.

1677  {
1679  const xmlChar *encoding;
1680  int ret;
1681 
1682  if ((fd < 0) || (result == NULL) || (style == NULL))
1683  return(-1);
1684  if (result->children == NULL)
1685  return(0);
1686 
1688  if (encoding != NULL) {
1689  xmlCharEncodingHandlerPtr encoder;
1690 
1691  encoder = xmlFindCharEncodingHandler((char *)encoding);
1692  if ((encoder != NULL) &&
1693  (xmlStrEqual((const xmlChar *)encoder->name,
1694  (const xmlChar *) "UTF-8")))
1695  encoder = NULL;
1696  buf = xmlOutputBufferCreateFd(fd, encoder);
1697  } else {
1698  buf = xmlOutputBufferCreateFd(fd, NULL);
1699  }
1700  if (buf == NULL)
1701  return(-1);
1703  ret = xmlOutputBufferClose(buf);
1704  return(ret);
1705 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static int fd
Definition: io.c:51
xmlOutputBuffer * xmlOutputBufferPtr
Definition: tree.h:32
int xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style)
Definition: xsltutils.c:1423
smooth NULL
Definition: ftsmooth.c:416
int ret
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
#define XSLT_GET_IMPORT_PTR(res, style, name)
Definition: imports.h:27
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
GLuint64EXT * result
Definition: glext.h:11304

◆ xsltSaveResultToFile()

int xsltSaveResultToFile ( FILE file,
xmlDocPtr  result,
xsltStylesheetPtr  style 
)

Definition at line 1633 of file xsltutils.c.

1633  {
1635  const xmlChar *encoding;
1636  int ret;
1637 
1638  if ((file == NULL) || (result == NULL) || (style == NULL))
1639  return(-1);
1640  if (result->children == NULL)
1641  return(0);
1642 
1644  if (encoding != NULL) {
1645  xmlCharEncodingHandlerPtr encoder;
1646 
1647  encoder = xmlFindCharEncodingHandler((char *)encoding);
1648  if ((encoder != NULL) &&
1649  (xmlStrEqual((const xmlChar *)encoder->name,
1650  (const xmlChar *) "UTF-8")))
1651  encoder = NULL;
1652  buf = xmlOutputBufferCreateFile(file, encoder);
1653  } else {
1654  buf = xmlOutputBufferCreateFile(file, NULL);
1655  }
1656 
1657  if (buf == NULL)
1658  return(-1);
1660  ret = xmlOutputBufferClose(buf);
1661  return(ret);
1662 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
xmlOutputBuffer * xmlOutputBufferPtr
Definition: tree.h:32
int xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style)
Definition: xsltutils.c:1423
smooth NULL
Definition: ftsmooth.c:416
int ret
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
#define XSLT_GET_IMPORT_PTR(res, style, name)
Definition: imports.h:27
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
GLuint64EXT * result
Definition: glext.h:11304
Definition: fci.c:126

Referenced by xsltDocumentElem().

◆ xsltSaveResultToFilename()

int xsltSaveResultToFilename ( const char URL,
xmlDocPtr  result,
xsltStylesheetPtr  style,
int  compression 
)

xsltSaveResultToFilename: @URL: a filename or URL

Returns
: the result xmlDocPtr @style: the stylesheet @compression: the compression factor (0 - 9 included)

Save the result

Returns
obtained by applying the @style stylesheet to a file or @URL

Returns the number of byte written or -1 in case of failure.

Definition at line 1589 of file xsltutils.c.

1590  {
1592  const xmlChar *encoding;
1593  int ret;
1594 
1595  if ((URL == NULL) || (result == NULL) || (style == NULL))
1596  return(-1);
1597  if (result->children == NULL)
1598  return(0);
1599 
1601  if (encoding != NULL) {
1602  xmlCharEncodingHandlerPtr encoder;
1603 
1604  encoder = xmlFindCharEncodingHandler((char *)encoding);
1605  if ((encoder != NULL) &&
1606  (xmlStrEqual((const xmlChar *)encoder->name,
1607  (const xmlChar *) "UTF-8")))
1608  encoder = NULL;
1609  buf = xmlOutputBufferCreateFilename(URL, encoder, compression);
1610  } else {
1611  buf = xmlOutputBufferCreateFilename(URL, NULL, compression);
1612  }
1613  if (buf == NULL)
1614  return(-1);
1616  ret = xmlOutputBufferClose(buf);
1617  return(ret);
1618 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
xmlOutputBuffer * xmlOutputBufferPtr
Definition: tree.h:32
int xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style)
Definition: xsltutils.c:1423
smooth NULL
Definition: ftsmooth.c:416
int ret
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
Definition: btrfs_drv.h:1301
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
#define XSLT_GET_IMPORT_PTR(res, style, name)
Definition: imports.h:27
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
GLuint64EXT * result
Definition: glext.h:11304

Referenced by xsltDocumentElem(), and xsltRunStylesheetUser().

◆ xsltSaveResultToString()

int xsltSaveResultToString ( xmlChar **  doc_txt_ptr,
int doc_txt_len,
xmlDocPtr  result,
xsltStylesheetPtr  style 
)

xsltSaveResultToString: @doc_txt_ptr: Memory pointer for allocated XML text @doc_txt_len: Length of the generated XML text

Returns
: the result xmlDocPtr @style: the stylesheet

Save the result

Returns
obtained by applying the @style stylesheet to a new allocated string.

Returns 0 in case of success and -1 in case of error

Definition at line 1720 of file xsltutils.c.

1721  {
1723  const xmlChar *encoding;
1724 
1725  *doc_txt_ptr = NULL;
1726  *doc_txt_len = 0;
1727  if (result->children == NULL)
1728  return(0);
1729 
1731  if (encoding != NULL) {
1732  xmlCharEncodingHandlerPtr encoder;
1733 
1734  encoder = xmlFindCharEncodingHandler((char *)encoding);
1735  if ((encoder != NULL) &&
1736  (xmlStrEqual((const xmlChar *)encoder->name,
1737  (const xmlChar *) "UTF-8")))
1738  encoder = NULL;
1739  buf = xmlAllocOutputBuffer(encoder);
1740  } else {
1741  buf = xmlAllocOutputBuffer(NULL);
1742  }
1743  if (buf == NULL)
1744  return(-1);
1746 #ifdef LIBXML2_NEW_BUFFER
1747  if (buf->conv != NULL) {
1748  *doc_txt_len = xmlBufUse(buf->conv);
1749  *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->conv), *doc_txt_len);
1750  } else {
1751  *doc_txt_len = xmlBufUse(buf->buffer);
1752  *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), *doc_txt_len);
1753  }
1754 #else
1755  if (buf->conv != NULL) {
1756  *doc_txt_len = buf->conv->use;
1757  *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
1758  } else {
1759  *doc_txt_len = buf->buffer->use;
1760  *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
1761  }
1762 #endif
1763  (void)xmlOutputBufferClose(buf);
1764  return 0;
1765 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
XMLPUBFUN xmlChar *XMLCALL xmlBufContent(const xmlBuf *buf)
Definition: buf.c:582
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
xmlOutputBuffer * xmlOutputBufferPtr
Definition: tree.h:32
int xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, xsltStylesheetPtr style)
Definition: xsltutils.c:1423
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
Definition: encoding.c:1641
unsigned char xmlChar
Definition: xmlstring.h:28
ed encoding
Definition: write.c:2839
#define XSLT_GET_IMPORT_PTR(res, style, name)
Definition: imports.h:27
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
GLuint64EXT * result
Definition: glext.h:11304
XMLPUBFUN size_t XMLCALL xmlBufUse(const xmlBufPtr buf)
Definition: buf.c:687

◆ xsltSetCtxtParseOptions()

int xsltSetCtxtParseOptions ( xsltTransformContextPtr  ctxt,
int  options 
)

xsltSetCtxtParseOptions: @ctxt: a XSLT process context @options: a combination of libxml2 xmlParserOption

Change the default parser option passed by the XSLT engine to the parser when using document() loading.

Returns the previous options or -1 in case of error

Definition at line 1388 of file xsltutils.c.

1389 {
1390  int oldopts;
1391 
1392  if (ctxt == NULL)
1393  return(-1);
1394  oldopts = ctxt->parserOptions;
1395  if (ctxt->xinclude)
1396  oldopts |= XML_PARSE_XINCLUDE;
1397  ctxt->parserOptions = options;
1399  ctxt->xinclude = 1;
1400  else
1401  ctxt->xinclude = 0;
1402  return(oldopts);
1403 }
smooth NULL
Definition: ftsmooth.c:416
int options
Definition: main.c:106

◆ xsltSetCtxtSortFunc()

void xsltSetCtxtSortFunc ( xsltTransformContextPtr  ctxt,
xsltSortFunc  handler 
)

xsltSetCtxtSortFunc: @ctxt: a XSLT process context @handler: the new handler function

Function to set the handler for XSLT sorting for the specified context. If the handler is NULL, then the global sort function will be called

Definition at line 1367 of file xsltutils.c.

1367  {
1368  ctxt->sortfunc = handler;
1369 }
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ xsltSetDebuggerCallbacks()

int xsltSetDebuggerCallbacks ( int  no,
void block 
)

xsltSetDebuggerCallbacks: @no : number of callbacks @block : the block of callbacks

This function allow to plug a debugger into the XSLT library @block points to a block of memory containing the address of @no callback routines.

Returns 0 in case of success and -1 in case of error

Definition at line 2396 of file xsltutils.c.

2397 {
2399 
2400  if ((block == NULL) || (no != XSLT_CALLBACK_NUMBER))
2401  return(-1);
2402 
2407  return(0);
2408 }
static unsigned int block
Definition: xmlmemory.c:118
xsltDebuggerCallbacks * xsltDebuggerCallbacksPtr
Definition: xsltutils.c:2344
xsltDropCallCallback drop
Definition: xsltutils.c:2348
smooth NULL
Definition: ftsmooth.c:416
static WCHAR no[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2340
xsltAddCallCallback add
Definition: xsltutils.c:2347
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
Definition: xsltutils.c:2351
#define XSLT_CALLBACK_NUMBER
Definition: xsltutils.c:2341
static int callbacks
Definition: xmllint.c:873
xsltHandleDebuggerCallback handler
Definition: xsltutils.c:2346

◆ xsltSetDebuggerStatus()

void xsltSetDebuggerStatus ( int  value)

xsltSetDebuggerStatus: @value : the value to be set

This function sets the value of xslDebugStatus.

Definition at line 2366 of file xsltutils.c.

2367 {
2369 }
int xslDebugStatus
Definition: xsltutils.c:2357
GLsizei const GLfloat * value
Definition: glext.h:6069

◆ xsltSetGenericDebugFunc()

void xsltSetGenericDebugFunc ( void ctx,
xmlGenericErrorFunc  handler 
)

xsltSetGenericDebugFunc: @ctx: the new error handling context @handler: the new handler function

Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing or validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL.

Definition at line 566 of file xsltutils.c.

566  {
568  if (handler != NULL)
570  else
571  xsltGenericDebug = xsltGenericDebugDefaultFunc;
572 }
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ xsltSetGenericErrorFunc()

void xsltSetGenericErrorFunc ( void ctx,
xmlGenericErrorFunc  handler 
)

xsltSetGenericErrorFunc: @ctx: the new error handling context @handler: the new handler function

Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing nor validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL.

Definition at line 520 of file xsltutils.c.

520  {
522  if (handler != NULL)
524  else
525  xsltGenericError = xsltGenericErrorDefaultFunc;
526 }
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericErrorContext
Definition: xsltutils.c:503
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ xsltSetSortFunc()

void xsltSetSortFunc ( xsltSortFunc  handler)

xsltSetSortFunc: @handler: the new handler function

Function to reset the global handler for XSLT sorting. If the handler is NULL, the default sort function will be used.

Definition at line 1349 of file xsltutils.c.

1349  {
1350  if (handler != NULL)
1352  else
1354 }
static xsltSortFunc xsltSortFunction
Definition: xsltutils.c:1315
smooth NULL
Definition: ftsmooth.c:416
void xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, int nbsorts)
Definition: xsltutils.c:1064
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ xsltSetTransformErrorFunc()

void xsltSetTransformErrorFunc ( xsltTransformContextPtr  ctxt,
void ctx,
xmlGenericErrorFunc  handler 
)

xsltSetTransformErrorFunc: @ctxt: the XSLT transformation context @ctx: the new error handling context @handler: the new handler function

Function to reset the handler and the error context for out of context error messages specific to a given XSLT transromation.

This simply means that @handler will be called for subsequent error messages while running the transformation.

Definition at line 659 of file xsltutils.c.

661 {
662  ctxt->error = handler;
663  ctxt->errctx = ctx;
664 }
xmlGenericErrorFunc error
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ xsltSplitQName()

const xmlChar* xsltSplitQName ( xmlDictPtr  dict,
const xmlChar name,
const xmlChar **  prefix 
)

Definition at line 720 of file xsltutils.c.

720  {
721  int len = 0;
722  const xmlChar *ret = NULL;
723 
724  *prefix = NULL;
725  if ((name == NULL) || (dict == NULL)) return(NULL);
726  if (name[0] == ':')
727  return(xmlDictLookup(dict, name, -1));
728  while ((name[len] != 0) && (name[len] != ':')) len++;
729  if (name[len] == 0) return(xmlDictLookup(dict, name, -1));
730  *prefix = xmlDictLookup(dict, name, len);
731  ret = xmlDictLookup(dict, &name[len + 1], -1);
732  return(ret);
733 }
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum GLsizei len
Definition: glext.h:6722
Definition: name.c:36

Referenced by xsltApplyAttributeSet(), xsltAttribute(), xsltAttributeComp(), xsltElement(), xsltElementComp(), xsltFormatNumberFunction(), xsltParseStylesheetAttributeSet(), and xsltProcessUserParamInternal().

◆ xsltTimestamp()

long xsltTimestamp ( void  )

xsltTimestamp:

Used for gathering profiling data

Returns the number of tenth of milliseconds since the beginning of the profiling

Definition at line 1815 of file xsltutils.c.

1816 {
1817 #ifdef XSLT_WIN32_PERFORMANCE_COUNTER
1818  BOOL ok;
1819  LARGE_INTEGER performanceCount;
1820  LARGE_INTEGER performanceFrequency;
1821  LONGLONG quadCount;
1822  double seconds;
1823  static LONGLONG startupQuadCount = 0;
1824  static LONGLONG startupQuadFreq = 0;
1825 
1826  ok = QueryPerformanceCounter(&performanceCount);
1827  if (!ok)
1828  return 0;
1829  quadCount = performanceCount.QuadPart;
1830  if (calibration < 0) {
1831  calibration = 0;
1832  ok = QueryPerformanceFrequency(&performanceFrequency);
1833  if (!ok)
1834  return 0;
1835  startupQuadFreq = performanceFrequency.QuadPart;
1836  startupQuadCount = quadCount;
1837  return (0);
1838  }
1839  if (startupQuadFreq == 0)
1840  return 0;
1841  seconds = (quadCount - startupQuadCount) / (double) startupQuadFreq;
1842  return (long) (seconds * XSLT_TIMESTAMP_TICS_PER_SEC);
1843 
1844 #else /* XSLT_WIN32_PERFORMANCE_COUNTER */
1845 #ifdef HAVE_CLOCK_GETTIME
1846 # if defined(CLOCK_MONOTONIC)
1847 # define XSLT_CLOCK CLOCK_MONOTONIC
1848 # elif defined(CLOCK_HIGHRES)
1849 # define XSLT_CLOCK CLOCK_HIGHRES
1850 # else
1851 # define XSLT_CLOCK CLOCK_REALTIME
1852 # endif
1853  static struct timespec startup;
1854  struct timespec cur;
1855  long tics;
1856 
1857  if (calibration < 0) {
1858  clock_gettime(XSLT_CLOCK, &startup);
1859  calibration = 0;
1860  calibration = xsltCalibrateTimestamps();
1861  clock_gettime(XSLT_CLOCK, &startup);
1862  return (0);
1863  }
1864 
1865  clock_gettime(XSLT_CLOCK, &cur);
1866  tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
1867  tics += (cur.tv_nsec - startup.tv_nsec) /
1868  (1000000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
1869 
1870  tics -= calibration;
1871  return(tics);
1872 
1873 #elif HAVE_GETTIMEOFDAY
1874  static struct timeval startup;
1875  struct timeval cur;
1876  long tics;
1877 
1878  if (calibration < 0) {
1880  calibration = 0;
1881  calibration = xsltCalibrateTimestamps();
1883  return (0);
1884  }
1885 
1886  gettimeofday(&cur, NULL);
1887  tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
1888  tics += (cur.tv_usec - startup.tv_usec) /
1889  (1000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
1890 
1891  tics -= calibration;
1892  return(tics);
1893 #else
1894 
1895  /* Neither gettimeofday() nor Win32 performance counter available */
1896 
1897  return (0);
1898 
1899 #endif /* HAVE_GETTIMEOFDAY */
1900 #endif /* XSLT_WIN32_PERFORMANCE_COUNTER */
1901 }
#define XSLT_TIMESTAMP_TICS_PER_SEC
Definition: xsltutils.h:269
int startup(int argc, const char *argv[])
Definition: startup.c:430
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
smooth NULL
Definition: ftsmooth.c:416
r l[0]
Definition: byte_order.h:167
int64_t LONGLONG
Definition: typedefs.h:66
static long calibration
Definition: xsltutils.c:1773
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
#define ok(value,...)
Definition: atltest.h:57
Definition: time.h:88
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by xsltApplyXSLTTemplate().

◆ xsltTransformError()

void xsltTransformError ( xsltTransformContextPtr  ctxt,
xsltStylesheetPtr  style,
xmlNodePtr  node,
const char msg,
  ... 
)

xsltTransformError: @ctxt: an XSLT transformation context @style: the XSLT stylesheet used @node: the current node in the stylesheet @msg: the message to display/transmit ...: extra parameters for the message display

Display and format an error messages, gives file, line, position and extra parameters, will use the specific transformation context if available

Definition at line 678 of file xsltutils.c.

681  {
683  void *errctx = xsltGenericErrorContext;
684  char * str;
685 
686  if (ctxt != NULL) {
687  if (ctxt->state == XSLT_STATE_OK)
688  ctxt->state = XSLT_STATE_ERROR;
689  if (ctxt->error != NULL) {
690  error = ctxt->error;
691  errctx = ctxt->errctx;
692  }
693  }
694  if ((node == NULL) && (ctxt != NULL))
695  node = ctxt->inst;
698  error(errctx, "%s", str);
699  if (str != NULL)
700  xmlFree(str);
701 }
#define error(str)
Definition: mkdosfs.c:1605
void xsltPrintErrorContext(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node)
Definition: xsltutils.c:583
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
xsltTransformState state
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
void * xsltGenericErrorContext
Definition: xsltutils.c:503
xmlGenericErrorFunc error
#define msg(x)
Definition: auth_time.c:54
void(XMLCDECL * xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:845
Arabic default style
Definition: afstyles.h:93
#define XSLT_GET_VAR_STR(msg, str)
Definition: xsltutils.c:453
Definition: dlist.c:348

Referenced by xsltAddKey(), xsltAddTemplate(), xsltAddTextString(), xsltAllocateExtraCtxt(), xsltApplyAttributeSet(), xsltApplyImports(), xsltApplySequenceConstructor(), xsltApplyStylesheetInternal(), xsltApplyTemplates(), xsltApplyTemplatesComp(), xsltApplyXSLTTemplate(), xsltAttribute(), xsltAttributeComp(), xsltAttrListTemplateProcess(), xsltAttrTemplateProcess(), xsltAttrTemplateValueProcessNode(), xsltCallTemplate(), xsltCheckInstructionElement(), xsltCheckParentElement(), xsltCheckRead(), xsltCheckTopLevelElement(), xsltCheckWrite(), xsltCheckWritePath(), xsltChoose(), xsltComment(), xsltCompileAttr(), xsltCompileIdKeyPattern(), xsltCompileLocationPathPattern(), xsltCompilePatternInternal(), xsltCompileStepPattern(), xsltCompMatchAdd(), xsltComputeAllKeys(), xsltCopyOf(), xsltCopyOfComp(), xsltCopyStackElem(), xsltCopyText(), xsltCopyTextString(), xsltCopyTree(), xsltCurrentFunction(), xsltDefaultProcessOneNode(), xsltDefaultSortFunction(), xsltDocumentElem(), xsltDocumentFunction(), xsltDocumentFunctionLoadDocument(), xsltElement(), xsltElementAvailableFunction(), xsltElementComp(), xsltEvalGlobalVariable(), xsltEvalGlobalVariables(), xsltEvalTemplateString(), xsltEvalVariable(), xsltEvalXPathPredicate(), xsltEvalXPathStringNs(), xsltExtElementPreCompTest(), xsltExtElementTest(), xsltExtFunctionTest(), xsltExtInitTest(), xsltExtShutdownTest(), xsltExtStyleInitTest(), xsltExtStyleShutdownTest(), xsltFlagRVTs(), xsltForEach(), xsltForEachComp(), xsltFormatNumberConversion(), xsltFormatNumberFunction(), xsltFunctionAvailableFunction(), xsltFunctionNodeSet(), xsltGatherNamespaces(), xsltGenerateIdFunction(), xsltGetExtData(), xsltGetQNameProperty(), xsltGetQNameURI2(), xsltGetSpecialNamespace(), xsltGlobalVariableLookup(), xsltIf(), xsltIfComp(), xsltInitCtxtKey(), xsltInitDocKeyTable(), xsltKeyFunction(), xsltLoadDocument(), xsltLoadStyleDocument(), xsltLoadStylesheetPI(), xsltLocaleStrcmp(), xsltMessage(), xsltNamespaceAlias(), xsltNewAttrVT(), xsltNewCompMatch(), xsltNewDocument(), xsltNewElemPreComp(), xsltNewExtData(), xsltNewExtDef(), xsltNewExtElement(), xsltNewExtModule(), xsltNewKeyDef(), xsltNewKeyTable(), xsltNewParserContext(), xsltNewSecurityPrefs(), xsltNewStackElem(), xsltNewStyleDocument(), xsltNewStylePreComp(), xsltNewStylesheet(), xsltNewTemplate(), xsltNewTransformContext(), xsltNumber(), xsltNumberComp(), xsltNumberFormatInsertNumbers(), xsltParamComp(), xsltParseContentError(), xsltParseGlobalParam(), xsltParseGlobalVariable(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetCallerParam(), xsltParseStylesheetDecimalFormat(), xsltParseStylesheetExcludePrefix(), xsltParseStylesheetExtPrefix(), xsltParseStylesheetFile(), xsltParseStylesheetImport(), xsltParseStylesheetInclude(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetParam(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetProcess(), xsltParseStylesheetStripSpace(), xsltParseStylesheetTemplate(), xsltParseStylesheetTop(), xsltParseStylesheetVariable(), xsltParseTemplateContent(), xsltProcessingInstruction(), xsltProcessUserParamInternal(), xsltRegisterGlobalVariable(), xsltRegisterVariable(), xsltReleaseLocalRVTs(), xsltResolveAttrSet(), xsltRunStylesheetUser(), xsltShallowCopyAttr(), xsltShallowCopyElem(), xsltShallowCopyNsNode(), xsltSort(), xsltSortComp(), xsltStrxfrm(), xsltStyleInitializeStylesheetModule(), xsltStylePreCompute(), xsltSystemPropertyFunction(), xsltTestCompMatch(), xsltText(), xsltTextComp(), xsltTransformCacheCreate(), xsltValueOf(), xsltValueOfComp(), xsltVariableComp(), xsltWhenComp(), xsltWithParamComp(), and xsltXPathVariableLookup().

◆ xsltXPathCompile()

xmlXPathCompExprPtr xsltXPathCompile ( xsltStylesheetPtr  style,
const xmlChar str 
)

xsltXPathCompile: @style: the stylesheet @str: the XPath expression

Compile an XPath expression

Returns the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.

Definition at line 2327 of file xsltutils.c.

2327  {
2328  return(xsltXPathCompileFlags(style, str, 0));
2329 }
const WCHAR * str
xmlXPathCompExprPtr xsltXPathCompileFlags(xsltStylesheetPtr style, const xmlChar *str, int flags)
Definition: xsltutils.c:2262
Arabic default style
Definition: afstyles.h:93

Referenced by xsltAddKey(), xsltApplyTemplatesComp(), xsltCompileAttr(), xsltCopyOfComp(), xsltForEachComp(), xsltIfComp(), xsltParamComp(), xsltSortComp(), xsltValueOfComp(), xsltVariableComp(), xsltWhenComp(), and xsltWithParamComp().

◆ xsltXPathCompileFlags()

xmlXPathCompExprPtr xsltXPathCompileFlags ( xsltStylesheetPtr  style,
const xmlChar str,
int  flags 
)

xsltXPathCompileFlags: @style: the stylesheet @str: the XPath expression @flags: extra compilation flags to pass down to libxml2 XPath

Compile an XPath expression

Returns the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.

Definition at line 2262 of file xsltutils.c.

2262  {
2263  xmlXPathContextPtr xpathCtxt;
2264  xmlXPathCompExprPtr ret;
2265 
2266  if (style != NULL) {
2267 #ifdef XSLT_REFACTORED_XPATHCOMP
2268  if (XSLT_CCTXT(style)) {
2269  /*
2270  * Proposed by Jerome Pesenti
2271  * --------------------------
2272  * For better efficiency we'll reuse the compilation
2273  * context's XPath context. For the common stylesheet using
2274  * XPath expressions this will reduce compilation time to
2275  * about 50%.
2276  *
2277  * See http://mail.gnome.org/archives/xslt/2006-April/msg00037.html
2278  */
2279  xpathCtxt = XSLT_CCTXT(style)->xpathCtxt;
2280  xpathCtxt->doc = style->doc;
2281  } else
2282  xpathCtxt = xmlXPathNewContext(style->doc);
2283 #else
2284  xpathCtxt = xmlXPathNewContext(style->doc);
2285 #endif
2286  if (xpathCtxt == NULL)
2287  return NULL;
2288  xpathCtxt->dict = style->dict;
2289  } else {
2290  xpathCtxt = xmlXPathNewContext(NULL);
2291  if (xpathCtxt == NULL)
2292  return NULL;
2293  }
2294  xpathCtxt->flags = flags;
2295 
2296  /*
2297  * Compile the expression.
2298  */
2299  ret = xmlXPathCtxtCompile(xpathCtxt, str);
2300 
2301 #ifdef XSLT_REFACTORED_XPATHCOMP
2302  if ((style == NULL) || (! XSLT_CCTXT(style))) {
2303  xmlXPathFreeContext(xpathCtxt);
2304  }
2305 #else
2306  xmlXPathFreeContext(xpathCtxt);
2307 #endif
2308  /*
2309  * TODO: there is a lot of optimizations which should be possible
2310  * like variable slot precomputations, function precomputations, etc.
2311  */
2312 
2313  return(ret);
2314 }
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLbitfield flags
Definition: glext.h:7161
int ret
Arabic default style
Definition: afstyles.h:93

Referenced by xsltAddKey(), and xsltXPathCompile().

Variable Documentation

◆ calibration

long calibration = -1
static

Definition at line 1773 of file xsltutils.c.

Referenced by xsltCalibrateAdjust(), and xsltTimestamp().

◆ xslDebugStatus

◆ xsltDebuggerCurrentCallbacks

xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks
static
Initial value:
= {
NULL,
NULL,
}
smooth NULL
Definition: ftsmooth.c:416

Definition at line 2351 of file xsltutils.c.

Referenced by xslAddCall(), xslDropCall(), xslHandleDebugger(), and xsltSetDebuggerCallbacks().

◆ xsltGenericDebug

xmlGenericErrorFunc xsltGenericDebug = xsltGenericDebugDefaultFunc

Definition at line 548 of file xsltutils.c.

Referenced by xsltAddKey(), xsltAddTemplate(), xsltApplyAttributeSet(), xsltApplyFallbacks(), xsltApplySequenceConstructor(), xsltApplyStripSpaces(), xsltApplyStylesheetInternal(), xsltApplyTemplates(), xsltApplyXSLTTemplate(), xsltBuildVariable(), xsltCallTemplate(), xsltChoose(), xsltComment(), xsltCompileAttr(), xsltCompilePatternInternal(), xsltComputeSortResult(), xsltCopy(), xsltCopyOf(), xsltCopyText(), xsltCopyTextString(), xsltDefaultProcessOneNode(), xsltDocDefaultLoaderFunc(), xsltDocumentComp(), xsltDocumentElem(), xsltEvalAttrValueTemplate(), xsltEvalGlobalVariable(), xsltEvalGlobalVariables(), xsltEvalVariable(), xsltEvalXPathPredicate(), xsltEvalXPathStringNs(), xsltExtElementPreCompTest(), xsltExtElementTest(), xsltExtFunctionTest(), xsltExtInitTest(), xsltExtShutdownTest(), xsltExtStyleInitTest(), xsltExtStyleShutdownTest(), xsltFlagRVTs(), xsltForEach(), xsltFreeStylesheet(), xsltFreeTransformContext(), xsltGatherNamespaces(), xsltGetExtData(), xsltGetInheritedNsList(), xsltGetKey(), xsltGlobalVariableLookup(), xsltIf(), xsltInitCtxtExt(), xsltInitCtxtExts(), xsltInitCtxtKey(), xsltInitCtxtKeys(), xsltInitDocKeyTable(), xsltLoadStylesheetPI(), xsltNewStylesheet(), xsltNewTransformContext(), xsltParseGlobalParam(), xsltParseGlobalVariable(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetCallerParam(), xsltParseStylesheetExcludePrefix(), xsltParseStylesheetExtPrefix(), xsltParseStylesheetFile(), xsltParseStylesheetImportedDoc(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetParam(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetProcess(), xsltParseStylesheetStripSpace(), xsltParseStylesheetTemplate(), xsltParseStylesheetTop(), xsltParseStylesheetVariable(), xsltParseTemplateContent(), xsltPreprocessStylesheet(), xsltProcessingInstruction(), xsltProcessOneNode(), xsltProcessUserParamInternal(), xsltRegisterExtPrefix(), xsltRegisterGlobalVariable(), xsltRegisterVariable(), xsltResolveAttrSet(), xsltResolveStylesheetAttributeSet(), xsltSetGenericDebugFunc(), xsltShutdownCtxtExt(), xsltShutdownExt(), xsltStyleInitializeStylesheetModule(), xsltText(), xsltValueOf(), xsltVariableLookup(), xsltXPathFunctionLookup(), and xsltXPathVariableLookup().

◆ xsltGenericDebugContext

void* xsltGenericDebugContext = NULL

Definition at line 549 of file xsltutils.c.

Referenced by xsltAddKey(), xsltAddTemplate(), xsltApplyAttributeSet(), xsltApplyFallbacks(), xsltApplySequenceConstructor(), xsltApplyStripSpaces(), xsltApplyStylesheetInternal(), xsltApplyTemplates(), xsltApplyXSLTTemplate(), xsltBuildVariable(), xsltCallTemplate(), xsltChoose(), xsltComment(), xsltCompileAttr(), xsltCompilePatternInternal(), xsltComputeSortResult(), xsltCopy(), xsltCopyOf(), xsltCopyText(), xsltCopyTextString(), xsltDebug(), xsltDefaultProcessOneNode(), xsltDocDefaultLoaderFunc(), xsltDocumentComp(), xsltDocumentElem(), xsltEvalAttrValueTemplate(), xsltEvalGlobalVariable(), xsltEvalGlobalVariables(), xsltEvalVariable(), xsltEvalXPathPredicate(), xsltEvalXPathStringNs(), xsltExtElementPreCompTest(), xsltExtElementTest(), xsltExtFunctionTest(), xsltExtInitTest(), xsltExtShutdownTest(), xsltExtStyleInitTest(), xsltExtStyleShutdownTest(), xsltFlagRVTs(), xsltForEach(), xsltFreeStylesheet(), xsltFreeTransformContext(), xsltGatherNamespaces(), xsltGetExtData(), xsltGetInheritedNsList(), xsltGetKey(), xsltGlobalVariableLookup(), xsltIf(), xsltInitCtxtExt(), xsltInitCtxtExts(), xsltInitCtxtKey(), xsltInitCtxtKeys(), xsltInitDocKeyTable(), xsltLoadStylesheetPI(), xsltNewStylesheet(), xsltNewTransformContext(), xsltParseGlobalParam(), xsltParseGlobalVariable(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetCallerParam(), xsltParseStylesheetExcludePrefix(), xsltParseStylesheetExtPrefix(), xsltParseStylesheetFile(), xsltParseStylesheetImportedDoc(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetParam(), xsltParseStylesheetPreserveSpace(), xsltParseStylesheetProcess(), xsltParseStylesheetStripSpace(), xsltParseStylesheetTemplate(), xsltParseStylesheetTop(), xsltParseStylesheetVariable(), xsltParseTemplateContent(), xsltPreprocessStylesheet(), xsltProcessingInstruction(), xsltProcessOneNode(), xsltProcessUserParamInternal(), xsltRegisterExtPrefix(), xsltRegisterGlobalVariable(), xsltRegisterVariable(), xsltResolveAttrSet(), xsltResolveStylesheetAttributeSet(), xsltSetGenericDebugFunc(), xsltShutdownCtxtExt(), xsltShutdownExt(), xsltStyleInitializeStylesheetModule(), xsltText(), xsltValueOf(), xsltVariableLookup(), xsltXPathFunctionLookup(), and xsltXPathVariableLookup().

◆ xsltGenericError

◆ xsltGenericErrorContext

◆ xsltSortFunction

xsltSortFunc xsltSortFunction = xsltDefaultSortFunction
static

Definition at line 1315 of file xsltutils.c.

Referenced by xsltDoSortFunction(), and xsltSetSortFunc().