ReactOS  0.4.13-dev-1174-gdff75d7
xslt.c File Reference
#include "precomp.h"
Include dependency graph for xslt.c:

Go to the source code of this file.

Macros

#define IS_BLANK(c)
 
#define IS_BLANK_NODE(n)   (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
 

Functions

double xmlXPathStringEvalNumber (const xmlChar *str)
 
static void xsltParseContentError (xsltStylesheetPtr style, xmlNodePtr node)
 
static int exclPrefixPush (xsltStylesheetPtr style, xmlChar *value)
 
static xmlCharexclPrefixPop (xsltStylesheetPtr style)
 
void xsltInit (void)
 
void xsltUninit (void)
 
int xsltIsBlank (xmlChar *str)
 
static xsltDecimalFormatPtr xsltNewDecimalFormat (const xmlChar *nsUri, xmlChar *name)
 
static void xsltFreeDecimalFormat (xsltDecimalFormatPtr self)
 
static void xsltFreeDecimalFormatList (xsltStylesheetPtr self)
 
: the decimal-format name to find

xsltDecimalFormatGetByName: @style: the XSLT stylesheet

Find decimal-format by name

Returns the xsltDecimalFormatPtr

xsltDecimalFormatPtr xsltDecimalFormatGetByName (xsltStylesheetPtr style, xmlChar *name)
 

Variables

const charxsltEngineVersion = LIBXSLT_VERSION_STRING LIBXSLT_VERSION_EXTRA
 
const int xsltLibxsltVersion = LIBXSLT_VERSION
 
const int xsltLibxmlVersion = LIBXML_VERSION
 
static int initialized = 0
 

: the local part of the QName

xsltDecimalFormatGetByQName: @style: the XSLT stylesheet @nsUri: the namespace URI of the QName

Find decimal-format by QName

Returns the xsltDecimalFormatPtr

#define CUR   (*cur)
 
#define SKIP(val)   cur += (val)
 
#define NXT(val)   cur[(val)]
 
#define SKIP_BLANKS   while (IS_BLANK(CUR)) NEXT
 
#define NEXT   ((*cur) ? cur++ : cur)
 
xsltDecimalFormatPtr xsltDecimalFormatGetByQName (xsltStylesheetPtr style, const xmlChar *nsUri, const xmlChar *name)
 
static xsltTemplatePtr xsltNewTemplate (void)
 
static void xsltFreeTemplate (xsltTemplatePtr template)
 
static void xsltFreeTemplateList (xsltTemplatePtr template)
 
xsltStylesheetPtr xsltNewStylesheet (void)
 
int xsltAllocateExtra (xsltStylesheetPtr style)
 
int xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt)
 
static void xsltFreeStylesheetList (xsltStylesheetPtr style)
 
static int xsltCleanupStylesheetTree (xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr rootElem ATTRIBUTE_UNUSED)
 
void xsltFreeStylesheet (xsltStylesheetPtr style)
 
static int xsltGetInheritedNsList (xsltStylesheetPtr style, xsltTemplatePtr template, xmlNodePtr node)
 
void xsltParseStylesheetOutput (xsltStylesheetPtr style, xmlNodePtr cur)
 
static void xsltParseStylesheetDecimalFormat (xsltStylesheetPtr style, xmlNodePtr cur)
 
static void xsltParseStylesheetPreserveSpace (xsltStylesheetPtr style, xmlNodePtr cur)
 
static void xsltParseStylesheetExtPrefix (xsltStylesheetPtr style, xmlNodePtr cur, int isXsltElem)
 
static void xsltParseStylesheetStripSpace (xsltStylesheetPtr style, xmlNodePtr cur)
 
static int xsltParseStylesheetExcludePrefix (xsltStylesheetPtr style, xmlNodePtr cur, int isXsltElem)
 
static void xsltPreprocessStylesheet (xsltStylesheetPtr style, xmlNodePtr cur)
 
static void xsltGatherNamespaces (xsltStylesheetPtr style)
 
void xsltParseTemplateContent (xsltStylesheetPtr style, xmlNodePtr templ)
 
static void xsltParseStylesheetKey (xsltStylesheetPtr style, xmlNodePtr key)
 
static void xsltParseStylesheetTemplate (xsltStylesheetPtr style, xmlNodePtr template)
 
static void xsltParseStylesheetTop (xsltStylesheetPtr style, xmlNodePtr top)
 
xsltStylesheetPtr xsltParseStylesheetProcess (xsltStylesheetPtr ret, xmlDocPtr doc)
 
xsltStylesheetPtr xsltParseStylesheetImportedDoc (xmlDocPtr doc, xsltStylesheetPtr parentStyle)
 
xsltStylesheetPtr xsltParseStylesheetDoc (xmlDocPtr doc)
 
xsltStylesheetPtr xsltParseStylesheetFile (const xmlChar *filename)
 
static xmlCharxsltParseStylesheetPI (const xmlChar *value)
 
xsltStylesheetPtr xsltLoadStylesheetPI (xmlDocPtr doc)
 

Macro Definition Documentation

◆ CUR

#define CUR   (*cur)

Definition at line 6767 of file xslt.c.

◆ IS_BLANK

#define IS_BLANK (   c)
Value:
(((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
((c) == 0x0D))
#define c
Definition: ke_i.h:80

Definition at line 79 of file xslt.c.

◆ IS_BLANK_NODE

#define IS_BLANK_NODE (   n)    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))

Definition at line 85 of file xslt.c.

◆ NEXT

#define NEXT   ((*cur) ? cur++ : cur)

Definition at line 6772 of file xslt.c.

◆ NXT

#define NXT (   val)    cur[(val)]

Definition at line 6769 of file xslt.c.

◆ SKIP

#define SKIP (   val)    cur += (val)

Definition at line 6768 of file xslt.c.

◆ SKIP_BLANKS

#define SKIP_BLANKS   while (IS_BLANK(CUR)) NEXT

Definition at line 6770 of file xslt.c.

Function Documentation

◆ exclPrefixPop()

static xmlChar* exclPrefixPop ( xsltStylesheetPtr  style)
static

exclPrefixPop: @style: the transformation stylesheet

Pop an excluded prefix value from the stack

Returns the stored excluded prefix value

Definition at line 170 of file xslt.c.

171 {
172  xmlChar *ret;
173 
174  if (style->exclPrefixNr <= 0)
175  return (0);
176  style->exclPrefixNr--;
177  if (style->exclPrefixNr > 0)
178  style->exclPrefix = style->exclPrefixTab[style->exclPrefixNr - 1];
179  else
180  style->exclPrefix = NULL;
181  ret = style->exclPrefixTab[style->exclPrefixNr];
182  style->exclPrefixTab[style->exclPrefixNr] = 0;
183  return (ret);
184 }
smooth NULL
Definition: ftsmooth.c:416
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
Arabic default style
Definition: afstyles.h:93

Referenced by xsltPreprocessStylesheet().

◆ exclPrefixPush()

static int exclPrefixPush ( xsltStylesheetPtr  style,
xmlChar value 
)
static

exclPrefixPush: @style: the transformation stylesheet @value: the excluded namespace name to push on the stack

Push an excluded namespace name on the stack

Returns the new index in the stack or -1 if already present or in case of error

Definition at line 127 of file xslt.c.

128 {
129  int i;
130 
131  if (style->exclPrefixMax == 0) {
132  style->exclPrefixMax = 4;
133  style->exclPrefixTab =
134  (xmlChar * *)xmlMalloc(style->exclPrefixMax *
135  sizeof(style->exclPrefixTab[0]));
136  if (style->exclPrefixTab == NULL) {
137  xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
138  return (-1);
139  }
140  }
141  /* do not push duplicates */
142  for (i = 0;i < style->exclPrefixNr;i++) {
143  if (xmlStrEqual(style->exclPrefixTab[i], value))
144  return(-1);
145  }
146  if (style->exclPrefixNr >= style->exclPrefixMax) {
147  style->exclPrefixMax *= 2;
148  style->exclPrefixTab =
149  (xmlChar * *)xmlRealloc(style->exclPrefixTab,
150  style->exclPrefixMax *
151  sizeof(style->exclPrefixTab[0]));
152  if (style->exclPrefixTab == NULL) {
153  xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
154  return (-1);
155  }
156  }
157  style->exclPrefixTab[style->exclPrefixNr] = value;
158  style->exclPrefix = value;
159  return (style->exclPrefixNr++);
160 }
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
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
unsigned char xmlChar
Definition: xmlstring.h:28
GLsizei const GLfloat * value
Definition: glext.h:6069
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xsltParseStylesheetExcludePrefix().

◆ xmlXPathStringEvalNumber()

double xmlXPathStringEvalNumber ( const xmlChar str)

◆ xsltAllocateExtra()

int xsltAllocateExtra ( xsltStylesheetPtr  style)

xsltAllocateExtra: @style: an XSLT stylesheet

Allocate an extra runtime information slot statically while compiling the stylesheet and return its number

Returns the number of the slot

Definition at line 793 of file xslt.c.

794 {
795  return(style->extrasNr++);
796 }
Arabic default style
Definition: afstyles.h:93

Referenced by xsltCompMatchAdd().

◆ xsltAllocateExtraCtxt()

int xsltAllocateExtraCtxt ( xsltTransformContextPtr  ctxt)

xsltAllocateExtraCtxt: @ctxt: an XSLT transformation context

Allocate an extra runtime information slot at run-time and return its number This make sure there is a slot ready in the transformation context

Returns the number of the slot

Definition at line 809 of file xslt.c.

810 {
811  if (ctxt->extrasNr >= ctxt->extrasMax) {
812  int i;
813  if (ctxt->extrasNr == 0) {
814  ctxt->extrasMax = 20;
815  ctxt->extras = (xsltRuntimeExtraPtr)
816  xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra));
817  if (ctxt->extras == NULL) {
819  "xsltAllocateExtraCtxt: out of memory\n");
820  return(0);
821  }
822  for (i = 0;i < ctxt->extrasMax;i++) {
823  ctxt->extras[i].info = NULL;
824  ctxt->extras[i].deallocate = NULL;
825  ctxt->extras[i].val.ptr = NULL;
826  }
827 
828  } else {
830 
831  ctxt->extrasMax += 100;
832  tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras,
833  ctxt->extrasMax * sizeof(xsltRuntimeExtra));
834  if (tmp == NULL) {
836  "xsltAllocateExtraCtxt: out of memory\n");
837  return(0);
838  }
839  ctxt->extras = tmp;
840  for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) {
841  ctxt->extras[i].info = NULL;
842  ctxt->extras[i].deallocate = NULL;
843  ctxt->extras[i].val.ptr = NULL;
844  }
845  }
846  }
847  return(ctxt->extrasNr++);
848 }
xsltRuntimeExtraPtr extras
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
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
union _xsltRuntimeExtra::@3307 val
xmlFreeFunc deallocate
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
xsltRuntimeExtra * xsltRuntimeExtraPtr

Referenced by xsltCompMatchAdd().

◆ xsltCleanupStylesheetTree()

static int xsltCleanupStylesheetTree ( xmlDocPtr doc  ATTRIBUTE_UNUSED,
xmlNodePtr rootElem  ATTRIBUTE_UNUSED 
)
static

xsltCleanupStylesheetTree:

@doc: the document-node @node: the element where the stylesheet is rooted at

Actually @node need not be the document-element, but currently Libxslt does not support embedded stylesheets.

Returns 0 if OK, -1 on API or internal errors.

Definition at line 879 of file xslt.c.

881 {
882 #if 0 /* TODO: Currently disabled, since probably not needed. */
883  xmlNodePtr cur;
884 
885  if ((doc == NULL) || (rootElem == NULL) ||
886  (rootElem->type != XML_ELEMENT_NODE) ||
887  (doc != rootElem->doc))
888  return(-1);
889 
890  /*
891  * Cleanup was suggested by Aleksey Sanin:
892  * Clear the PSVI field to avoid problems if the
893  * node-tree of the stylesheet is intended to be used for
894  * further processing by the user (e.g. for compiling it
895  * once again - although not recommended).
896  */
897 
898  cur = rootElem;
899  while (cur != NULL) {
900  if (cur->type == XML_ELEMENT_NODE) {
901  /*
902  * Clear the PSVI field.
903  */
904  cur->psvi = NULL;
905  if (cur->children) {
906  cur = cur->children;
907  continue;
908  }
909  }
910 
911 leave_node:
912  if (cur == rootElem)
913  break;
914  if (cur->next != NULL)
915  cur = cur->next;
916  else {
917  cur = cur->parent;
918  if (cur == NULL)
919  break;
920  goto leave_node;
921  }
922  }
923 #endif /* #if 0 */
924  return(0);
925 }
void * psvi
Definition: tree.h:505
smooth NULL
Definition: ftsmooth.c:416
struct _xmlNode * parent
Definition: tree.h:495
Definition: tree.h:489
xmlElementType type
Definition: tree.h:491
struct _xmlNode * next
Definition: tree.h:496
struct _xmlNode * children
Definition: tree.h:493

Referenced by xsltFreeStylesheet(), and xsltParseStylesheetImportedDoc().

◆ xsltDecimalFormatGetByName()

xsltDecimalFormatPtr xsltDecimalFormatGetByName ( xsltStylesheetPtr  style,
xmlChar name 
)

Definition at line 334 of file xslt.c.

335 {
337 
338  if (name == NULL)
339  return style->decimalFormat;
340 
341  while (style != NULL) {
342  for (result = style->decimalFormat->next;
343  result != NULL;
344  result = result->next) {
345  if ((result->nsUri == NULL) && xmlStrEqual(name, result->name))
346  return result;
347  }
349  }
350  return result;
351 }
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:36
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
WCHAR * name
Definition: name.c:40

◆ xsltDecimalFormatGetByQName()

xsltDecimalFormatPtr xsltDecimalFormatGetByQName ( xsltStylesheetPtr  style,
const xmlChar nsUri,
const xmlChar name 
)

Definition at line 364 of file xslt.c.

366 {
368 
369  if (name == NULL)
370  return style->decimalFormat;
371 
372  while (style != NULL) {
373  for (result = style->decimalFormat->next;
374  result != NULL;
375  result = result->next) {
376  if (xmlStrEqual(nsUri, result->nsUri) &&
378  return result;
379  }
381  }
382  return result;
383 }
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:36
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
WCHAR * name
Definition: name.c:40

Referenced by xsltFormatNumberFunction(), and xsltParseStylesheetDecimalFormat().

◆ xsltFreeDecimalFormat()

static void xsltFreeDecimalFormat ( xsltDecimalFormatPtr  self)
static

Definition at line 278 of file xslt.c.

279 {
280  if (self != NULL) {
281  if (self->digit)
282  xmlFree(self->digit);
283  if (self->patternSeparator)
284  xmlFree(self->patternSeparator);
285  if (self->decimalPoint)
286  xmlFree(self->decimalPoint);
287  if (self->grouping)
288  xmlFree(self->grouping);
289  if (self->percent)
290  xmlFree(self->percent);
291  if (self->permille)
292  xmlFree(self->permille);
293  if (self->zeroDigit)
294  xmlFree(self->zeroDigit);
295  if (self->minusSign)
296  xmlFree(self->minusSign);
297  if (self->infinity)
298  xmlFree(self->infinity);
299  if (self->noNumber)
300  xmlFree(self->noNumber);
301  if (self->name)
302  xmlFree(self->name);
303  xmlFree(self);
304  }
305 }
xmlChar * decimalPoint
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlChar * patternSeparator

Referenced by xsltFreeDecimalFormatList().

◆ xsltFreeDecimalFormatList()

static void xsltFreeDecimalFormatList ( xsltStylesheetPtr  self)
static

Definition at line 308 of file xslt.c.

309 {
312 
313  if (self == NULL)
314  return;
315 
316  iter = self->decimalFormat;
317  while (iter != NULL) {
318  tmp = iter->next;
319  xsltFreeDecimalFormat(iter);
320  iter = tmp;
321  }
322 }
static void xsltFreeDecimalFormat(xsltDecimalFormatPtr self)
Definition: xslt.c:278
struct _xsltDecimalFormat * next
smooth NULL
Definition: ftsmooth.c:416

Referenced by xsltFreeStylesheet().

◆ xsltFreeStylesheet()

void xsltFreeStylesheet ( xsltStylesheetPtr  style)

xsltFreeStylesheet: @style: an XSLT stylesheet

Free up the memory allocated by @style

Definition at line 934 of file xslt.c.

935 {
936  if (style == NULL)
937  return;
938 
939 #ifdef XSLT_REFACTORED
940  /*
941  * Start with a cleanup of the main stylesheet's doc.
942  */
943  if ((style->principal == style) && (style->doc))
946 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
947  /*
948  * Restore changed ns-decls before freeing the document.
949  */
950  if ((style->doc != NULL) &&
951  XSLT_HAS_INTERNAL_NSMAP(style))
952  {
953  xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style),
954  style->doc);
955  }
956 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
957 #else
958  /*
959  * Start with a cleanup of the main stylesheet's doc.
960  */
961  if ((style->parent == NULL) && (style->doc))
964 #endif /* XSLT_REFACTORED */
965 
970  xsltFreeTemplateList(style->templates);
974  /*
975  * Free documents of all included stylsheet modules of this
976  * stylesheet level.
977  */
979  /*
980  * TODO: Best time to shutdown extension stuff?
981  */
983 
984  if (style->variables != NULL)
985  xsltFreeStackElemList(style->variables);
986  if (style->cdataSection != NULL)
987  xmlHashFree(style->cdataSection, NULL);
988  if (style->stripSpaces != NULL)
989  xmlHashFree(style->stripSpaces, NULL);
990  if (style->nsHash != NULL)
991  xmlHashFree(style->nsHash, NULL);
992  if (style->exclPrefixTab != NULL)
993  xmlFree(style->exclPrefixTab);
994  if (style->method != NULL)
995  xmlFree(style->method);
996  if (style->methodURI != NULL)
997  xmlFree(style->methodURI);
998  if (style->version != NULL)
999  xmlFree(style->version);
1000  if (style->encoding != NULL)
1001  xmlFree(style->encoding);
1002  if (style->doctypePublic != NULL)
1003  xmlFree(style->doctypePublic);
1004  if (style->doctypeSystem != NULL)
1005  xmlFree(style->doctypeSystem);
1006  if (style->mediaType != NULL)
1007  xmlFree(style->mediaType);
1008  if (style->attVTs)
1009  xsltFreeAVTList(style->attVTs);
1010  if (style->imports != NULL)
1011  xsltFreeStylesheetList(style->imports);
1012 
1013 #ifdef XSLT_REFACTORED
1014  /*
1015  * If this is the principal stylesheet, then
1016  * free its internal data.
1017  */
1018  if (style->principal == style) {
1019  if (style->principalData) {
1020  xsltFreePrincipalStylesheetData(style->principalData);
1021  style->principalData = NULL;
1022  }
1023  }
1024 #endif
1025  /*
1026  * Better to free the main document of this stylesheet level
1027  * at the end - so here.
1028  */
1029  if (style->doc != NULL) {
1030  xmlFreeDoc(style->doc);
1031  }
1032 
1033 #ifdef WITH_XSLT_DEBUG
1035  "freeing dictionary from stylesheet\n");
1036 #endif
1037  xmlDictFree(style->dict);
1038 
1039  memset(style, -1, sizeof(xsltStylesheet));
1040  xmlFree(style);
1041 }
void xsltFreeExts(xsltStylesheetPtr style)
Definition: extensions.c:479
void xsltFreeTemplateHashes(xsltStylesheetPtr style)
Definition: pattern.c:2573
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
static int xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr rootElem ATTRIBUTE_UNUSED)
Definition: xslt.c:879
void xsltFreeAttributeSetsHashes(xsltStylesheetPtr style)
Definition: attributes.c:1205
static void xsltFreeStylesheetList(xsltStylesheetPtr style)
Definition: xslt.c:857
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:793
static void xsltFreeTemplateList(xsltTemplatePtr template)
Definition: xslt.c:445
void xsltFreeNamespaceAliasHashes(xsltStylesheetPtr style)
Definition: namespaces.c:811
static void xsltFreeDecimalFormatList(xsltStylesheetPtr self)
Definition: xslt.c:308
void xsltFreeKeys(xsltStylesheetPtr style)
Definition: keys.c:185
void xsltFreeStylePreComps(xsltStylesheetPtr style)
Definition: preproc.c:1935
void xsltFreeStackElemList(xsltStackElemPtr elem)
Definition: variables.c:606
void xsltShutdownExts(xsltStylesheetPtr style)
Definition: extensions.c:1133
void xsltFreeAVTList(void *avt)
Definition: attrvt.c:113
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
Arabic default style
Definition: afstyles.h:93
#define memset(x, y, z)
Definition: compat.h:39
void xsltFreeStyleDocuments(xsltStylesheetPtr style)
Definition: documents.c:193

Referenced by xsltDocumentElem(), xsltFreeStylesheetList(), xsltNewStylesheet(), and xsltParseStylesheetImportedDoc().

◆ xsltFreeStylesheetList()

static void xsltFreeStylesheetList ( xsltStylesheetPtr  style)
static

xsltFreeStylesheetList: @style: an XSLT stylesheet list

Free up the memory allocated by the list @style

Definition at line 857 of file xslt.c.

857  {
859 
860  while (style != NULL) {
861  next = style->next;
863  style = next;
864  }
865 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:934
smooth NULL
Definition: ftsmooth.c:416
static unsigned __int64 next
Definition: rand_nt.c:6
Arabic default style
Definition: afstyles.h:93

Referenced by xsltFreeStylesheet().

◆ xsltFreeTemplate()

static void xsltFreeTemplate ( xsltTemplatePtr  template)
static

xsltFreeTemplate: @template: an XSLT template

Free up the memory allocated by @template

Definition at line 415 of file xslt.c.

415  {
416  if (template == NULL)
417  return;
418  if (template->match) xmlFree(template->match);
419 /*
420 * NOTE: @name and @nameURI are put into the string dict now.
421 * if (template->name) xmlFree(template->name);
422 * if (template->nameURI) xmlFree(template->nameURI);
423 */
424 /*
425  if (template->mode) xmlFree(template->mode);
426  if (template->modeURI) xmlFree(template->modeURI);
427  */
428  if (template->inheritedNs) xmlFree(template->inheritedNs);
429 
430  /* free profiling data */
431  if (template->templCalledTab) xmlFree(template->templCalledTab);
432  if (template->templCountTab) xmlFree(template->templCountTab);
433 
434  memset(template, -1, sizeof(xsltTemplate));
435  xmlFree(template);
436 }
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
const UINT template
Definition: action.c:7785
#define memset(x, y, z)
Definition: compat.h:39

Referenced by xsltFreeTemplateList().

◆ xsltFreeTemplateList()

static void xsltFreeTemplateList ( xsltTemplatePtr  template)
static

xsltFreeTemplateList: @template: an XSLT template list

Free up the memory allocated by all the elements of @template

Definition at line 445 of file xslt.c.

445  {
446  xsltTemplatePtr cur;
447 
448  while (template != NULL) {
449  cur = template;
450  template = template->next;
451  xsltFreeTemplate(cur);
452  }
453 }
struct _xsltTemplate * next
smooth NULL
Definition: ftsmooth.c:416
static void xsltFreeTemplate(xsltTemplatePtr template)
Definition: xslt.c:415

Referenced by xsltFreeStylesheet().

◆ xsltGatherNamespaces()

static void xsltGatherNamespaces ( xsltStylesheetPtr  style)
static

xsltGatherNamespaces: @style: the XSLT stylesheet

Browse the stylesheet and build the namspace hash table which will be used for XPath interpretation. If needed do a bit of normalization

Definition at line 3659 of file xslt.c.

3659  {
3660  xmlNodePtr cur;
3661  const xmlChar *URI;
3662 
3663  if (style == NULL)
3664  return;
3665  /*
3666  * TODO: basically if the stylesheet uses the same prefix for different
3667  * patterns, well they may be in problem, hopefully they will get
3668  * a warning first.
3669  */
3670  /*
3671  * TODO: Eliminate the use of the hash for XPath expressions.
3672  * An expression should be evaluated in the context of the in-scope
3673  * namespaces; eliminate the restriction of an XML document to contain
3674  * no duplicate prefixes for different namespace names.
3675  *
3676  */
3677  cur = xmlDocGetRootElement(style->doc);
3678  while (cur != NULL) {
3679  if (cur->type == XML_ELEMENT_NODE) {
3680  xmlNsPtr ns = cur->nsDef;
3681  while (ns != NULL) {
3682  if (ns->prefix != NULL) {
3683  if (style->nsHash == NULL) {
3684  style->nsHash = xmlHashCreate(10);
3685  if (style->nsHash == NULL) {
3687  "xsltGatherNamespaces: failed to create hash table\n");
3688  style->errors++;
3689  return;
3690  }
3691  }
3692  URI = xmlHashLookup(style->nsHash, ns->prefix);
3693  if ((URI != NULL) && (!xmlStrEqual(URI, ns->href))) {
3695  "Namespaces prefix %s used for multiple namespaces\n",ns->prefix);
3696  style->warnings++;
3697  } else if (URI == NULL) {
3698  xmlHashUpdateEntry(style->nsHash, ns->prefix,
3699  (void *) ns->href, NULL);
3700 
3701 #ifdef WITH_XSLT_DEBUG_PARSING
3703  "Added namespace: %s mapped to %s\n", ns->prefix, ns->href);
3704 #endif
3705  }
3706  }
3707  ns = ns->next;
3708  }
3709  }
3710 
3711  /*
3712  * Skip to next node
3713  */
3714  if (cur->children != NULL) {
3715  if (cur->children->type != XML_ENTITY_DECL) {
3716  cur = cur->children;
3717  continue;
3718  }
3719  }
3720  if (cur->next != NULL) {
3721  cur = cur->next;
3722  continue;
3723  }
3724 
3725  do {
3726  cur = cur->parent;
3727  if (cur == NULL)
3728  break;
3729  if (cur == (xmlNodePtr) style->doc) {
3730  cur = NULL;
3731  break;
3732  }
3733  if (cur->next != NULL) {
3734  cur = cur->next;
3735  break;
3736  }
3737  } while (cur != NULL);
3738  }
3739 }
Definition: tree.h:389
xmlNs * nsDef
Definition: tree.h:504
smooth NULL
Definition: ftsmooth.c:416
struct _xmlNode * parent
Definition: tree.h:495
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
Definition: tree.h:489
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN int XMLCALL xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f)
Definition: hash.c:423
BSTR prefix
Definition: mxnamespace.c:46
xmlElementType type
Definition: tree.h:491
struct _xmlNode * next
Definition: tree.h:496
struct _xmlNode * children
Definition: tree.h:493
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
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
Arabic default style
Definition: afstyles.h:93

Referenced by xsltParseStylesheetImportedDoc().

◆ xsltGetInheritedNsList()

static int xsltGetInheritedNsList ( xsltStylesheetPtr  style,
xsltTemplatePtr  template,
xmlNodePtr  node 
)
static

xsltGetInheritedNsList: @style: the stylesheet @template: the template @node: the current node

Search all the namespace applying to a given element except the ones from excluded output prefixes currently in scope. Initialize the template inheritedNs list with it.

Returns the number of entries found

Definition at line 1067 of file xslt.c.

1070 {
1071  xmlNsPtr cur;
1072  xmlNsPtr *ret = NULL;
1073  int nbns = 0;
1074  int maxns = 10;
1075  int i;
1076 
1077  if ((style == NULL) || (template == NULL) || (node == NULL) ||
1078  (template->inheritedNsNr != 0) || (template->inheritedNs != NULL))
1079  return(0);
1080  while (node != NULL) {
1081  if (node->type == XML_ELEMENT_NODE) {
1082  cur = node->nsDef;
1083  while (cur != NULL) {
1084  if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
1085  goto skip_ns;
1086 
1087  if ((cur->prefix != NULL) &&
1088  (xsltCheckExtPrefix(style, cur->prefix)))
1089  goto skip_ns;
1090  /*
1091  * Check if this namespace was excluded.
1092  * Note that at this point only the exclusions defined
1093  * on the topmost stylesheet element are in the exclusion-list.
1094  */
1095  for (i = 0;i < style->exclPrefixNr;i++) {
1096  if (xmlStrEqual(cur->href, style->exclPrefixTab[i]))
1097  goto skip_ns;
1098  }
1099  if (ret == NULL) {
1100  ret =
1101  (xmlNsPtr *) xmlMalloc((maxns + 1) *
1102  sizeof(xmlNsPtr));
1103  if (ret == NULL) {
1105  "xsltGetInheritedNsList : out of memory!\n");
1106  return(0);
1107  }
1108  ret[nbns] = NULL;
1109  }
1110  /*
1111  * Skip shadowed namespace bindings.
1112  */
1113  for (i = 0; i < nbns; i++) {
1114  if ((cur->prefix == ret[i]->prefix) ||
1115  (xmlStrEqual(cur->prefix, ret[i]->prefix)))
1116  break;
1117  }
1118  if (i >= nbns) {
1119  if (nbns >= maxns) {
1120  maxns *= 2;
1121  ret = (xmlNsPtr *) xmlRealloc(ret,
1122  (maxns +
1123  1) *
1124  sizeof(xmlNsPtr));
1125  if (ret == NULL) {
1127  "xsltGetInheritedNsList : realloc failed!\n");
1128  return(0);
1129  }
1130  }
1131  ret[nbns++] = cur;
1132  ret[nbns] = NULL;
1133  }
1134 skip_ns:
1135  cur = cur->next;
1136  }
1137  }
1138  node = node->parent;
1139  }
1140  if (nbns != 0) {
1141 #ifdef WITH_XSLT_DEBUG_PARSING
1143  "template has %d inherited namespaces\n", nbns);
1144 #endif
1145  template->inheritedNsNr = nbns;
1146  template->inheritedNs = ret;
1147  }
1148  return (nbns);
1149 }
struct _xmlNs * next
Definition: tree.h:390
Definition: tree.h:389
xmlNs * xmlNsPtr
Definition: tree.h:388
#define XSLT_NAMESPACE
Definition: xslt.h:46
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
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
void * xsltGenericDebugContext
Definition: xsltutils.c:549
int xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1158
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
const UINT template
Definition: action.c:7785
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
const xmlChar * prefix
Definition: tree.h:393
Arabic default style
Definition: afstyles.h:93
const xmlChar * href
Definition: tree.h:392
Definition: dlist.c:348
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xsltParseStylesheetTemplate().

◆ xsltInit()

void xsltInit ( void  )

xsltInit:

Initializes the processor (e.g. registers built-in extensions, etc.)

Definition at line 201 of file xslt.c.

201  {
202  if (initialized == 0) {
203  initialized = 1;
204 #ifdef XSLT_LOCALE_WINAPI
205  xsltLocaleMutex = xmlNewRMutex();
206 #endif
208  }
209 }
XMLPUBFUN xmlRMutexPtr XMLCALL xmlNewRMutex(void)
Definition: threads.c:285
void xsltRegisterAllExtras(void)
Definition: extra.c:149
static int initialized
Definition: xslt.c:193

Referenced by xsltNewStylesheet().

◆ xsltIsBlank()

int xsltIsBlank ( xmlChar str)

xsltIsBlank: @str: a string

Check if a string is ignorable

Returns 1 if the string is NULL or made of blanks chars, 0 otherwise

Definition at line 234 of file xslt.c.

234  {
235  if (str == NULL)
236  return(1);
237  while (*str != 0) {
238  if (!(IS_BLANK(*str))) return(0);
239  str++;
240  }
241  return(1);
242 }
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define IS_BLANK(c)
Definition: xslt.c:79

Referenced by xsltVariableComp().

◆ xsltLoadStylesheetPI()

xsltStylesheetPtr xsltLoadStylesheetPI ( xmlDocPtr  doc)

xsltLoadStylesheetPI: @doc: a document to process

This function tries to locate the stylesheet PI in the given document If found, and if contained within the document, it will extract that subtree to build the stylesheet to process @doc (doc itself will be modified). If found but referencing an external document it will attempt to load it and generate a stylesheet from it. In both cases, the resulting stylesheet and the document need to be freed once the transformation is done.

Returns a new XSLT stylesheet structure or NULL if not found.

Definition at line 6875 of file xslt.c.

6875  {
6876  xmlNodePtr child;
6878  xmlChar *href = NULL;
6879  xmlURIPtr URI;
6880 
6881  xsltInitGlobals();
6882 
6883  if (doc == NULL)
6884  return(NULL);
6885 
6886  /*
6887  * Find the text/xml stylesheet PI id any before the root
6888  */
6889  child = doc->children;
6890  while ((child != NULL) && (child->type != XML_ELEMENT_NODE)) {
6891  if ((child->type == XML_PI_NODE) &&
6892  (xmlStrEqual(child->name, BAD_CAST "xml-stylesheet"))) {
6893  href = xsltParseStylesheetPI(child->content);
6894  if (href != NULL)
6895  break;
6896  }
6897  child = child->next;
6898  }
6899 
6900  /*
6901  * If found check the href to select processing
6902  */
6903  if (href != NULL) {
6904 #ifdef WITH_XSLT_DEBUG_PARSING
6906  "xsltLoadStylesheetPI : found PI href=%s\n", href);
6907 #endif
6908  URI = xmlParseURI((const char *) href);
6909  if (URI == NULL) {
6911  "xml-stylesheet : href %s is not valid\n", href);
6912  xmlFree(href);
6913  return(NULL);
6914  }
6915  if ((URI->fragment != NULL) && (URI->scheme == NULL) &&
6916  (URI->opaque == NULL) && (URI->authority == NULL) &&
6917  (URI->server == NULL) && (URI->user == NULL) &&
6918  (URI->path == NULL) && (URI->query == NULL)) {
6919  xmlAttrPtr ID;
6920 
6921 #ifdef WITH_XSLT_DEBUG_PARSING
6923  "xsltLoadStylesheetPI : Reference to ID %s\n", href);
6924 #endif
6925  if (URI->fragment[0] == '#')
6926  ID = xmlGetID(doc, (const xmlChar *) &(URI->fragment[1]));
6927  else
6928  ID = xmlGetID(doc, (const xmlChar *) URI->fragment);
6929  if (ID == NULL) {
6931  "xml-stylesheet : no ID %s found\n", URI->fragment);
6932  } else {
6933  xmlDocPtr fake;
6934  xmlNodePtr subtree, newtree;
6935  xmlNsPtr ns;
6936 
6937 #ifdef WITH_XSLT_DEBUG
6939  "creating new document from %s for embedded stylesheet\n",
6940  doc->URL);
6941 #endif
6942  /*
6943  * move the subtree in a new document passed to
6944  * the stylesheet analyzer
6945  */
6946  subtree = ID->parent;
6947  fake = xmlNewDoc(NULL);
6948  if (fake != NULL) {
6949  /*
6950  * Should the dictionary still be shared even though
6951  * the nodes are being copied rather than moved?
6952  */
6953  fake->dict = doc->dict;
6954  xmlDictReference(doc->dict);
6955 #ifdef WITH_XSLT_DEBUG
6957  "reusing dictionary from %s for embedded stylesheet\n",
6958  doc->URL);
6959 #endif
6960 
6961  newtree = xmlDocCopyNode(subtree, fake, 1);
6962 
6963  fake->URL = xmlNodeGetBase(doc, subtree->parent);
6964 #ifdef WITH_XSLT_DEBUG
6966  "set base URI for embedded stylesheet as %s\n",
6967  fake->URL);
6968 #endif
6969 
6970  /*
6971  * Add all namespaces in scope of embedded stylesheet to
6972  * root element of newly created stylesheet document
6973  */
6974  while ((subtree = subtree->parent) != (xmlNodePtr)doc) {
6975  for (ns = subtree->ns; ns; ns = ns->next) {
6976  xmlNewNs(newtree, ns->href, ns->prefix);
6977  }
6978  }
6979 
6980  xmlAddChild((xmlNodePtr)fake, newtree);
6981  ret = xsltParseStylesheetDoc(fake);
6982  if (ret == NULL)
6983  xmlFreeDoc(fake);
6984  }
6985  }
6986  } else {
6987  xmlChar *URL, *base;
6988 
6989  /*
6990  * Reference to an external stylesheet
6991  */
6992 
6993  base = xmlNodeGetBase(doc, (xmlNodePtr) doc);
6994  URL = xmlBuildURI(href, base);
6995  if (URL != NULL) {
6996 #ifdef WITH_XSLT_DEBUG_PARSING
6998  "xsltLoadStylesheetPI : fetching %s\n", URL);
6999 #endif
7001  xmlFree(URL);
7002  } else {
7003 #ifdef WITH_XSLT_DEBUG_PARSING
7005  "xsltLoadStylesheetPI : fetching %s\n", href);
7006 #endif
7007  ret = xsltParseStylesheetFile(href);
7008  }
7009  if (base != NULL)
7010  xmlFree(base);
7011  }
7012  xmlFreeURI(URI);
7013  xmlFree(href);
7014  }
7015  return(ret);
7016 }
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:638
const xmlChar * URL
Definition: tree.h:577
Definition: tree.h:389
char * opaque
Definition: uri.h:35
XMLPUBFUN xmlURIPtr XMLCALL xmlParseURI(const char *str)
Definition: uri.c:932
XMLPUBFUN xmlChar *XMLCALL xmlNodeGetBase(const xmlDoc *doc, const xmlNode *cur)
static HWND child
Definition: cursoricon.c:298
XMLPUBFUN xmlAttrPtr XMLCALL xmlGetID(xmlDocPtr doc, const xmlChar *ID)
Definition: valid.c:2803
char * server
Definition: uri.h:37
static xmlChar * xsltParseStylesheetPI(const xmlChar *value)
Definition: xslt.c:6785
char * query
Definition: uri.h:41
GLuint base
Definition: 3dtext.c:35
char * authority
Definition: uri.h:36
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1882
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
struct _xmlNode * parent
Definition: tree.h:495
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
Definition: tree.h:489
int ret
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
xsltStylesheetPtr xsltParseStylesheetFile(const xmlChar *filename)
Definition: xslt.c:6714
#define ID
Definition: ruserpass.c:36
BSTR prefix
Definition: mxnamespace.c:46
XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix)
char * path
Definition: uri.h:40
xsltStylesheetPtr xsltParseStylesheetDoc(xmlDocPtr doc)
Definition: xslt.c:6680
Definition: uri.h:33
char * scheme
Definition: uri.h:34
char * user
Definition: uri.h:38
XMLPUBFUN void XMLCALL xmlFreeURI(xmlURIPtr uri)
Definition: uri.c:1379
Definition: tree.h:551
Definition: tree.h:434
XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNode(xmlNodePtr node, xmlDocPtr doc, int recursive)
struct _xmlNode * children
Definition: tree.h:555
xmlNs * ns
Definition: tree.h:501
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
void xsltInitGlobals(void)
Definition: extensions.c:2263
XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc(const xmlChar *version)
struct _xmlDict * dict
Definition: tree.h:580
char * fragment
Definition: uri.h:42

◆ xsltNewDecimalFormat()

static xsltDecimalFormatPtr xsltNewDecimalFormat ( const xmlChar nsUri,
xmlChar name 
)
static

Definition at line 250 of file xslt.c.

251 {
253  /* UTF-8 for 0x2030 */
254  static const xmlChar permille[4] = {0xe2, 0x80, 0xb0, 0};
255 
256  self = xmlMalloc(sizeof(xsltDecimalFormat));
257  if (self != NULL) {
258  self->next = NULL;
259  self->nsUri = nsUri;
260  self->name = name;
261 
262  /* Default values */
263  self->digit = xmlStrdup(BAD_CAST("#"));
264  self->patternSeparator = xmlStrdup(BAD_CAST(";"));
265  self->decimalPoint = xmlStrdup(BAD_CAST("."));
266  self->grouping = xmlStrdup(BAD_CAST(","));
267  self->percent = xmlStrdup(BAD_CAST("%"));
268  self->permille = xmlStrdup(BAD_CAST(permille));
269  self->zeroDigit = xmlStrdup(BAD_CAST("0"));
270  self->minusSign = xmlStrdup(BAD_CAST("-"));
271  self->infinity = xmlStrdup(BAD_CAST("Infinity"));
272  self->noNumber = xmlStrdup(BAD_CAST("NaN"));
273  }
274  return self;
275 }
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by xsltNewStylesheet(), and xsltParseStylesheetDecimalFormat().

◆ xsltNewStylesheet()

xsltStylesheetPtr xsltNewStylesheet ( void  )

xsltNewStylesheet:

Create a new XSLT Stylesheet

Returns the newly allocated xsltStylesheetPtr or NULL in case of error

Definition at line 742 of file xslt.c.

742  {
744 
746  if (ret == NULL) {
748  "xsltNewStylesheet : malloc failed\n");
749  goto internal_err;
750  }
751  memset(ret, 0, sizeof(xsltStylesheet));
752 
753  ret->omitXmlDeclaration = -1;
754  ret->standalone = -1;
755  ret->decimalFormat = xsltNewDecimalFormat(NULL, NULL);
756  ret->indent = -1;
757  ret->errors = 0;
758  ret->warnings = 0;
759  ret->exclPrefixNr = 0;
760  ret->exclPrefixMax = 0;
761  ret->exclPrefixTab = NULL;
762  ret->extInfos = NULL;
763  ret->extrasNr = 0;
764  ret->internalized = 1;
765  ret->literal_result = 0;
766  ret->forwards_compatible = 0;
767  ret->dict = xmlDictCreate();
768 #ifdef WITH_XSLT_DEBUG
770  "creating dictionary for stylesheet\n");
771 #endif
772 
773  xsltInit();
774 
775  return(ret);
776 
777 internal_err:
778  if (ret != NULL)
780  return(NULL);
781 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:934
XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate(void)
Definition: dict.c:568
static xsltDecimalFormatPtr xsltNewDecimalFormat(const xmlChar *nsUri, xmlChar *name)
Definition: xslt.c:250
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltInit(void)
Definition: xslt.c:201
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
#define memset(x, y, z)
Definition: compat.h:39
xsltStylesheet * xsltStylesheetPtr

Referenced by xsltDocumentElem(), and xsltParseStylesheetImportedDoc().

◆ xsltNewTemplate()

static xsltTemplatePtr xsltNewTemplate ( void  )
static

xsltNewTemplate:

Create a new XSLT Template

Returns the newly allocated xsltTemplatePtr or NULL in case of error

Definition at line 394 of file xslt.c.

394  {
395  xsltTemplatePtr cur;
396 
397  cur = (xsltTemplatePtr) xmlMalloc(sizeof(xsltTemplate));
398  if (cur == NULL) {
400  "xsltNewTemplate : malloc failed\n");
401  return(NULL);
402  }
403  memset(cur, 0, sizeof(xsltTemplate));
405  return(cur);
406 }
#define XSLT_PAT_NO_PRIORITY
xsltTemplate * xsltTemplatePtr
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
#define memset(x, y, z)
Definition: compat.h:39

Referenced by xsltParseStylesheetProcess(), and xsltParseStylesheetTemplate().

◆ xsltParseContentError()

static void xsltParseContentError ( xsltStylesheetPtr  style,
xmlNodePtr  node 
)
static

xsltParseContentError:

@style: the stylesheet @node: the node where the error occured

Compile-time error function.

Definition at line 97 of file xslt.c.

99 {
100  if ((style == NULL) || (node == NULL))
101  return;
102 
103  if (IS_XSLT_ELEM(node))
105  "The XSLT-element '%s' is not allowed at this position.\n",
106  node->name);
107  else
109  "The element '%s' is not allowed at this position.\n",
110  node->name);
111  style->errors++;
112 }
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
smooth NULL
Definition: ftsmooth.c:416
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 xsltParseStylesheetDecimalFormat(), xsltParseStylesheetKey(), xsltParseStylesheetOutput(), xsltParseStylesheetPreserveSpace(), and xsltParseStylesheetStripSpace().

◆ xsltParseStylesheetDecimalFormat()

static void xsltParseStylesheetDecimalFormat ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)
static

xsltParseStylesheetDecimalFormat: @style: the XSLT stylesheet @cur: the "decimal-format" element

<xsl:decimal-format name = qname, decimal-separator = char, grouping-separator = char, infinity = string, minus-sign = char, NaN = string, percent = char per-mille = char, zero-digit = char, digit = char, pattern-separator = char />

parse an XSLT stylesheet decimal-format element and and record the formatting characteristics

Definition at line 1380 of file xslt.c.

1381 {
1382  xmlChar *prop;
1384  xsltDecimalFormatPtr iter;
1385 
1386  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1387  return;
1388 
1389  format = style->decimalFormat;
1390 
1391  prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL);
1392  if (prop != NULL) {
1393  const xmlChar *nsUri;
1394 
1395  if (xmlValidateQName(prop, 0) != 0) {
1397  "xsl:decimal-format: Invalid QName '%s'.\n", prop);
1398  style->warnings++;
1399  xmlFree(prop);
1400  return;
1401  }
1402  /*
1403  * TODO: Don't use xsltGetQNameURI().
1404  */
1405  nsUri = xsltGetQNameURI(cur, &prop);
1406  if (prop == NULL) {
1407  style->warnings++;
1408  return;
1409  }
1410  format = xsltDecimalFormatGetByQName(style, nsUri, prop);
1411  if (format != NULL) {
1413  "xsltParseStylestyleDecimalFormat: %s already exists\n", prop);
1414  style->warnings++;
1415  xmlFree(prop);
1416  return;
1417  }
1418  format = xsltNewDecimalFormat(nsUri, prop);
1419  if (format == NULL) {
1421  "xsltParseStylestyleDecimalFormat: failed creating new decimal-format\n");
1422  style->errors++;
1423  xmlFree(prop);
1424  return;
1425  }
1426  /* Append new decimal-format structure */
1427  for (iter = style->decimalFormat; iter->next; iter = iter->next)
1428  ;
1429  if (iter)
1430  iter->next = format;
1431  }
1432 
1433  prop = xmlGetNsProp(cur, (const xmlChar *)"decimal-separator", NULL);
1434  if (prop != NULL) {
1435  if (format->decimalPoint != NULL) xmlFree(format->decimalPoint);
1436  format->decimalPoint = prop;
1437  }
1438 
1439  prop = xmlGetNsProp(cur, (const xmlChar *)"grouping-separator", NULL);
1440  if (prop != NULL) {
1441  if (format->grouping != NULL) xmlFree(format->grouping);
1442  format->grouping = prop;
1443  }
1444 
1445  prop = xmlGetNsProp(cur, (const xmlChar *)"infinity", NULL);
1446  if (prop != NULL) {
1447  if (format->infinity != NULL) xmlFree(format->infinity);
1448  format->infinity = prop;
1449  }
1450 
1451  prop = xmlGetNsProp(cur, (const xmlChar *)"minus-sign", NULL);
1452  if (prop != NULL) {
1453  if (format->minusSign != NULL) xmlFree(format->minusSign);
1454  format->minusSign = prop;
1455  }
1456 
1457  prop = xmlGetNsProp(cur, (const xmlChar *)"NaN", NULL);
1458  if (prop != NULL) {
1459  if (format->noNumber != NULL) xmlFree(format->noNumber);
1460  format->noNumber = prop;
1461  }
1462 
1463  prop = xmlGetNsProp(cur, (const xmlChar *)"percent", NULL);
1464  if (prop != NULL) {
1465  if (format->percent != NULL) xmlFree(format->percent);
1466  format->percent = prop;
1467  }
1468 
1469  prop = xmlGetNsProp(cur, (const xmlChar *)"per-mille", NULL);
1470  if (prop != NULL) {
1471  if (format->permille != NULL) xmlFree(format->permille);
1472  format->permille = prop;
1473  }
1474 
1475  prop = xmlGetNsProp(cur, (const xmlChar *)"zero-digit", NULL);
1476  if (prop != NULL) {
1477  if (format->zeroDigit != NULL) xmlFree(format->zeroDigit);
1478  format->zeroDigit = prop;
1479  }
1480 
1481  prop = xmlGetNsProp(cur, (const xmlChar *)"digit", NULL);
1482  if (prop != NULL) {
1483  if (format->digit != NULL) xmlFree(format->digit);
1484  format->digit = prop;
1485  }
1486 
1487  prop = xmlGetNsProp(cur, (const xmlChar *)"pattern-separator", NULL);
1488  if (prop != NULL) {
1489  if (format->patternSeparator != NULL) xmlFree(format->patternSeparator);
1490  format->patternSeparator = prop;
1491  }
1492  if (cur->children != NULL) {
1494  }
1495 }
struct _xsltDecimalFormat * next
static xsltDecimalFormatPtr xsltNewDecimalFormat(const xmlChar *nsUri, xmlChar *name)
Definition: xslt.c:250
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
xsltDecimalFormatPtr xsltDecimalFormatGetByQName(xsltStylesheetPtr style, const xmlChar *nsUri, const xmlChar *name)
Definition: xslt.c:364
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
unsigned char xmlChar
Definition: xmlstring.h:28
xmlElementType type
Definition: tree.h:491
struct _xmlNode * children
Definition: tree.h:493
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93
static void xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node)
Definition: xslt.c:97
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetDoc()

xsltStylesheetPtr xsltParseStylesheetDoc ( xmlDocPtr  doc)

xsltParseStylesheetDoc: @doc: and xmlDoc parsed XML

parse an XSLT stylesheet, building the associated structures. doc is kept as a reference within the returned stylesheet, so changes to doc after the parsing will be reflected when the stylesheet is applied, and the doc is automatically freed when the stylesheet is closed.

Returns a new XSLT stylesheet structure.

Definition at line 6680 of file xslt.c.

6680  {
6682 
6683  xsltInitGlobals();
6684 
6686  if (ret == NULL)
6687  return(NULL);
6688 
6690 #ifdef XSLT_REFACTORED
6691  /*
6692  * Free the compilation context.
6693  * TODO: Check if it's better to move this cleanup to
6694  * xsltParseStylesheetImportedDoc().
6695  */
6696  if (ret->compCtxt != NULL) {
6697  xsltCompilationCtxtFree(XSLT_CCTXT(ret));
6698  ret->compCtxt = NULL;
6699  }
6700 #endif
6701  return(ret);
6702 }
xsltStylesheetPtr xsltParseStylesheetImportedDoc(xmlDocPtr doc, xsltStylesheetPtr parentStyle)
Definition: xslt.c:6499
smooth NULL
Definition: ftsmooth.c:416
int ret
void xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style)
Definition: attributes.c:670
void xsltInitGlobals(void)
Definition: extensions.c:2263

Referenced by xsltLoadStylesheetPI(), and xsltParseStylesheetFile().

◆ xsltParseStylesheetExcludePrefix()

static int xsltParseStylesheetExcludePrefix ( xsltStylesheetPtr  style,
xmlNodePtr  cur,
int  isXsltElem 
)
static

xsltParseStylesheetExcludePrefix: @style: the XSLT stylesheet @cur: the current point in the stylesheet

parse an XSLT stylesheet exclude prefix and record namespaces needing stripping

Returns the number of Excluded prefixes added at that level

Definition at line 1716 of file xslt.c.

1718 {
1719  int nb = 0;
1720  xmlChar *prefixes;
1721  xmlChar *prefix, *end;
1722 
1723  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1724  return(0);
1725 
1726  if (isXsltElem)
1727  prefixes = xmlGetNsProp(cur,
1728  (const xmlChar *)"exclude-result-prefixes", NULL);
1729  else
1730  prefixes = xmlGetNsProp(cur,
1731  (const xmlChar *)"exclude-result-prefixes", XSLT_NAMESPACE);
1732 
1733  if (prefixes == NULL) {
1734  return(0);
1735  }
1736 
1737  prefix = prefixes;
1738  while (*prefix != 0) {
1739  while (IS_BLANK(*prefix)) prefix++;
1740  if (*prefix == 0)
1741  break;
1742  end = prefix;
1743  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1744  prefix = xmlStrndup(prefix, end - prefix);
1745  if (prefix) {
1746  xmlNsPtr ns;
1747 
1748  if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
1749  ns = xmlSearchNs(style->doc, cur, NULL);
1750  else
1751  ns = xmlSearchNs(style->doc, cur, prefix);
1752  if (ns == NULL) {
1754  "xsl:exclude-result-prefixes : undefined namespace %s\n",
1755  prefix);
1756  if (style != NULL) style->warnings++;
1757  } else {
1758  if (exclPrefixPush(style, (xmlChar *) ns->href) >= 0) {
1759 #ifdef WITH_XSLT_DEBUG_PARSING
1761  "exclude result prefix %s\n", prefix);
1762 #endif
1763  nb++;
1764  }
1765  }
1766  xmlFree(prefix);
1767  }
1768  prefix = end;
1769  }
1770  xmlFree(prefixes);
1771  return(nb);
1772 }
static int prefixes
Definition: i386-dis.c:266
static int exclPrefixPush(xsltStylesheetPtr style, xmlChar *value)
Definition: xslt.c:127
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
GLuint GLuint end
Definition: gl.h:1545
#define XSLT_NAMESPACE
Definition: xslt.h:46
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
xmlElementType type
Definition: tree.h:491
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
Arabic default style
Definition: afstyles.h:93

Referenced by xsltParseStylesheetProcess(), and xsltPreprocessStylesheet().

◆ xsltParseStylesheetExtPrefix()

static void xsltParseStylesheetExtPrefix ( xsltStylesheetPtr  style,
xmlNodePtr  cur,
int  isXsltElem 
)
static

xsltParseStylesheetExtPrefix: @style: the XSLT stylesheet @template: the "extension-element-prefixes" prefix

parse an XSLT stylesheet's "extension-element-prefix" attribute value and register the namespaces of extension instruction. SPEC "A namespace is designated as an extension namespace by using an extension-element-prefixes attribute on: 1) an xsl:stylesheet element 2) an xsl:extension-element-prefixes attribute on a literal result element 3) an extension instruction."

Definition at line 1580 of file xslt.c.

1581  {
1582  xmlChar *prefixes;
1583  xmlChar *prefix, *end;
1584 
1585  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1586  return;
1587 
1588  if (isXsltElem) {
1589  /* For xsl:stylesheet/xsl:transform. */
1590  prefixes = xmlGetNsProp(cur,
1591  (const xmlChar *)"extension-element-prefixes", NULL);
1592  } else {
1593  /* For literal result elements and extension instructions. */
1594  prefixes = xmlGetNsProp(cur,
1595  (const xmlChar *)"extension-element-prefixes", XSLT_NAMESPACE);
1596  }
1597  if (prefixes == NULL) {
1598  return;
1599  }
1600 
1601  prefix = prefixes;
1602  while (*prefix != 0) {
1603  while (IS_BLANK(*prefix)) prefix++;
1604  if (*prefix == 0)
1605  break;
1606  end = prefix;
1607  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1608  prefix = xmlStrndup(prefix, end - prefix);
1609  if (prefix) {
1610  xmlNsPtr ns;
1611 
1612  if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
1613  ns = xmlSearchNs(style->doc, cur, NULL);
1614  else
1615  ns = xmlSearchNs(style->doc, cur, prefix);
1616  if (ns == NULL) {
1618  "xsl:extension-element-prefix : undefined namespace %s\n",
1619  prefix);
1620  if (style != NULL) style->warnings++;
1621  } else {
1622 #ifdef WITH_XSLT_DEBUG_PARSING
1624  "add extension prefix %s\n", prefix);
1625 #endif
1626  xsltRegisterExtPrefix(style, prefix, ns->href);
1627  }
1628  xmlFree(prefix);
1629  }
1630  prefix = end;
1631  }
1632  xmlFree(prefixes);
1633 }
static int prefixes
Definition: i386-dis.c:266
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
GLuint GLuint end
Definition: gl.h:1545
#define XSLT_NAMESPACE
Definition: xslt.h:46
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
int xsltRegisterExtPrefix(xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:503
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
xmlElementType type
Definition: tree.h:491
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
Arabic default style
Definition: afstyles.h:93

Referenced by xsltParseStylesheetProcess().

◆ xsltParseStylesheetFile()

xsltStylesheetPtr xsltParseStylesheetFile ( const xmlChar filename)

xsltParseStylesheetFile: @filename: the filename/URL to the stylesheet

Load and parse an XSLT stylesheet

Returns a new XSLT stylesheet structure.

Definition at line 6714 of file xslt.c.

6714  {
6717  xmlDocPtr doc;
6718 
6719  xsltInitGlobals();
6720 
6721  if (filename == NULL)
6722  return(NULL);
6723 
6724 #ifdef WITH_XSLT_DEBUG_PARSING
6726  "xsltParseStylesheetFile : parse %s\n", filename);
6727 #endif
6728 
6729  /*
6730  * Security framework check
6731  */
6733  if (sec != NULL) {
6734  int res;
6735 
6736  res = xsltCheckRead(sec, NULL, filename);
6737  if (res == 0) {
6739  "xsltParseStylesheetFile: read rights for %s denied\n",
6740  filename);
6741  return(NULL);
6742  }
6743  }
6744 
6747  if (doc == NULL) {
6749  "xsltParseStylesheetFile : cannot parse %s\n", filename);
6750  return(NULL);
6751  }
6752  ret = xsltParseStylesheetDoc(doc);
6753  if (ret == NULL) {
6754  xmlFreeDoc(doc);
6755  return(NULL);
6756  }
6757 
6758  return(ret);
6759 }
xsltDocLoaderFunc xsltDocDefaultLoader
Definition: documents.c:93
int xsltCheckRead(xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL)
Definition: security.c:400
const char * filename
Definition: ioapi.h:135
#define XSLT_PARSE_OPTIONS
Definition: xslt.h:54
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
xsltStylesheetPtr xsltParseStylesheetDoc(xmlDocPtr doc)
Definition: xslt.c:6680
Definition: tree.h:551
GLuint res
Definition: glext.h:9613
xsltSecurityPrefsPtr xsltGetDefaultSecurityPrefs(void)
Definition: security.c:163
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
void xsltInitGlobals(void)
Definition: extensions.c:2263

Referenced by xsltLoadStylesheetPI().

◆ xsltParseStylesheetImportedDoc()

xsltStylesheetPtr xsltParseStylesheetImportedDoc ( xmlDocPtr  doc,
xsltStylesheetPtr  parentStyle 
)

xsltParseStylesheetImportedDoc: @doc: an xmlDoc parsed XML @parentStyle: pointer to the parent stylesheet (if it exists)

parse an XSLT stylesheet building the associated structures except the processing not needed for imported documents.

Returns a new XSLT stylesheet structure.

Definition at line 6499 of file xslt.c.

6500  {
6501  xsltStylesheetPtr retStyle;
6502 
6503  if (doc == NULL)
6504  return(NULL);
6505 
6506  retStyle = xsltNewStylesheet();
6507  if (retStyle == NULL)
6508  return(NULL);
6509  /*
6510  * Set the importing stylesheet module; also used to detect recursion.
6511  */
6512  retStyle->parent = parentStyle;
6513  /*
6514  * Adjust the string dict.
6515  */
6516  if (doc->dict != NULL) {
6517  xmlDictFree(retStyle->dict);
6518  retStyle->dict = doc->dict;
6519 #ifdef WITH_XSLT_DEBUG
6521  "reusing dictionary from %s for stylesheet\n",
6522  doc->URL);
6523 #endif
6524  xmlDictReference(retStyle->dict);
6525  }
6526 
6527  /*
6528  * TODO: Eliminate xsltGatherNamespaces(); we must not restrict
6529  * the stylesheet to containt distinct namespace prefixes.
6530  */
6531  xsltGatherNamespaces(retStyle);
6532 
6533 #ifdef XSLT_REFACTORED
6534  {
6535  xsltCompilerCtxtPtr cctxt;
6536  xsltStylesheetPtr oldCurSheet;
6537 
6538  if (parentStyle == NULL) {
6539  xsltPrincipalStylesheetDataPtr principalData;
6540  /*
6541  * Principal stylesheet
6542  * --------------------
6543  */
6544  retStyle->principal = retStyle;
6545  /*
6546  * Create extra data for the principal stylesheet.
6547  */
6548  principalData = xsltNewPrincipalStylesheetData();
6549  if (principalData == NULL) {
6550  xsltFreeStylesheet(retStyle);
6551  return(NULL);
6552  }
6553  retStyle->principalData = principalData;
6554  /*
6555  * Create the compilation context
6556  * ------------------------------
6557  * (only once; for the principal stylesheet).
6558  * This is currently the only function where the
6559  * compilation context is created.
6560  */
6561  cctxt = xsltCompilationCtxtCreate(retStyle);
6562  if (cctxt == NULL) {
6563  xsltFreeStylesheet(retStyle);
6564  return(NULL);
6565  }
6566  retStyle->compCtxt = (void *) cctxt;
6567  cctxt->style = retStyle;
6568  cctxt->dict = retStyle->dict;
6569  cctxt->psData = principalData;
6570  /*
6571  * Push initial dummy node info.
6572  */
6573  cctxt->depth = -1;
6574  xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
6575  } else {
6576  /*
6577  * Imported stylesheet.
6578  */
6579  retStyle->principal = parentStyle->principal;
6580  cctxt = parentStyle->compCtxt;
6581  retStyle->compCtxt = cctxt;
6582  }
6583  /*
6584  * Save the old and set the current stylesheet structure in the
6585  * compilation context.
6586  */
6587  oldCurSheet = cctxt->style;
6588  cctxt->style = retStyle;
6589 
6590  retStyle->doc = doc;
6591  xsltParseStylesheetProcess(retStyle, doc);
6592 
6593  cctxt->style = oldCurSheet;
6594  if (parentStyle == NULL) {
6595  /*
6596  * Pop the initial dummy node info.
6597  */
6598  xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
6599  } else {
6600  /*
6601  * Clear the compilation context of imported
6602  * stylesheets.
6603  * TODO: really?
6604  */
6605  /* retStyle->compCtxt = NULL; */
6606  }
6607  /*
6608  * Free the stylesheet if there were errors.
6609  */
6610  if (retStyle != NULL) {
6611  if (retStyle->errors != 0) {
6612 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
6613  /*
6614  * Restore all changes made to namespace URIs of ns-decls.
6615  */
6616  if (cctxt->psData->nsMap)
6617  xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc);
6618 #endif
6619  /*
6620  * Detach the doc from the stylesheet; otherwise the doc
6621  * will be freed in xsltFreeStylesheet().
6622  */
6623  retStyle->doc = NULL;
6624  /*
6625  * Cleanup the doc if its the main stylesheet.
6626  */
6627  if (parentStyle == NULL) {
6629  if (retStyle->compCtxt != NULL) {
6630  xsltCompilationCtxtFree(retStyle->compCtxt);
6631  retStyle->compCtxt = NULL;
6632  }
6633  }
6634 
6635  xsltFreeStylesheet(retStyle);
6636  retStyle = NULL;
6637  }
6638  }
6639  }
6640 
6641 #else /* XSLT_REFACTORED */
6642  /*
6643  * Old behaviour.
6644  */
6645  retStyle->doc = doc;
6646  if (xsltParseStylesheetProcess(retStyle, doc) == NULL) {
6647  retStyle->doc = NULL;
6648  xsltFreeStylesheet(retStyle);
6649  retStyle = NULL;
6650  }
6651  if (retStyle != NULL) {
6652  if (retStyle->errors != 0) {
6653  retStyle->doc = NULL;
6654  if (parentStyle == NULL)
6656  xmlDocGetRootElement(doc));
6657  xsltFreeStylesheet(retStyle);
6658  retStyle = NULL;
6659  }
6660  }
6661 #endif /* else of XSLT_REFACTORED */
6662 
6663  return(retStyle);
6664 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:934
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:638
const xmlChar * URL
Definition: tree.h:577
struct _xsltStylesheet * parent
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
static int xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr rootElem ATTRIBUTE_UNUSED)
Definition: xslt.c:879
Definition: tree.h:489
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:793
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
struct _xmlDict * dict
Definition: tree.h:580
xsltStylesheetPtr principal
xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc)
Definition: xslt.c:6391
static void xsltGatherNamespaces(xsltStylesheetPtr style)
Definition: xslt.c:3659
xsltStylesheetPtr xsltNewStylesheet(void)
Definition: xslt.c:742

Referenced by xsltParseStylesheetDoc(), and xsltParseStylesheetImport().

◆ xsltParseStylesheetKey()

static void xsltParseStylesheetKey ( xsltStylesheetPtr  style,
xmlNodePtr  key 
)
static

xsltParseStylesheetKey: @style: the XSLT stylesheet @key: the "key" element

<xsl:key name = qname, match = pattern, use = expression />

parse an XSLT stylesheet key definition and register it

Definition at line 5083 of file xslt.c.

5083  {
5084  xmlChar *prop = NULL;
5085  xmlChar *use = NULL;
5086  xmlChar *match = NULL;
5087  xmlChar *name = NULL;
5088  xmlChar *nameURI = NULL;
5089 
5090  if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE))
5091  return;
5092 
5093  /*
5094  * Get arguments
5095  */
5096  prop = xmlGetNsProp(key, (const xmlChar *)"name", NULL);
5097  if (prop != NULL) {
5098  const xmlChar *URI;
5099 
5100  /*
5101  * TODO: Don't use xsltGetQNameURI().
5102  */
5103  URI = xsltGetQNameURI(key, &prop);
5104  if (prop == NULL) {
5105  if (style != NULL) style->errors++;
5106  goto error;
5107  } else {
5108  name = prop;
5109  if (URI != NULL)
5110  nameURI = xmlStrdup(URI);
5111  }
5112 #ifdef WITH_XSLT_DEBUG_PARSING
5114  "xsltParseStylesheetKey: name %s\n", name);
5115 #endif
5116  } else {
5118  "xsl:key : error missing name\n");
5119  if (style != NULL) style->errors++;
5120  goto error;
5121  }
5122 
5123  match = xmlGetNsProp(key, (const xmlChar *)"match", NULL);
5124  if (match == NULL) {
5126  "xsl:key : error missing match\n");
5127  if (style != NULL) style->errors++;
5128  goto error;
5129  }
5130 
5131  use = xmlGetNsProp(key, (const xmlChar *)"use", NULL);
5132  if (use == NULL) {
5134  "xsl:key : error missing use\n");
5135  if (style != NULL) style->errors++;
5136  goto error;
5137  }
5138 
5139  /*
5140  * register the keys
5141  */
5142  xsltAddKey(style, name, nameURI, match, use, key);
5143 
5144 
5145 error:
5146  if (use != NULL)
5147  xmlFree(use);
5148  if (match != NULL)
5149  xmlFree(match);
5150  if (name != NULL)
5151  xmlFree(name);
5152  if (nameURI != NULL)
5153  xmlFree(nameURI);
5154 
5155  if (key->children != NULL) {
5156  xsltParseContentError(style, key->children);
5157  }
5158 }
int xsltAddKey(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *nameURI, const xmlChar *match, const xmlChar *use, xmlNodePtr inst)
Definition: keys.c:261
#define error(str)
Definition: mkdosfs.c:1605
Definition: match.c:28
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
unsigned char xmlChar
Definition: xmlstring.h:28
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
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
Definition: path.c:42
static void xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node)
Definition: xslt.c:97
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetOutput()

void xsltParseStylesheetOutput ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)

xsltParseStylesheetOutput: @style: the XSLT stylesheet @cur: the "output" element

parse an XSLT stylesheet output element and record information related to the stylesheet output

Definition at line 1162 of file xslt.c.

1163 {
1164  xmlChar *elements,
1165  *prop;
1166  xmlChar *element,
1167  *end;
1168 
1169  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1170  return;
1171 
1172  prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL);
1173  if (prop != NULL) {
1174  if (style->version != NULL)
1175  xmlFree(style->version);
1176  style->version = prop;
1177  }
1178 
1179  prop = xmlGetNsProp(cur, (const xmlChar *) "encoding", NULL);
1180  if (prop != NULL) {
1181  if (style->encoding != NULL)
1182  xmlFree(style->encoding);
1183  style->encoding = prop;
1184  }
1185 
1186  /* relaxed to support xt:document
1187  * TODO KB: What does "relaxed to support xt:document" mean?
1188  */
1189  prop = xmlGetNsProp(cur, (const xmlChar *) "method", NULL);
1190  if (prop != NULL) {
1191  const xmlChar *URI;
1192 
1193  if (style->method != NULL)
1194  xmlFree(style->method);
1195  style->method = NULL;
1196  if (style->methodURI != NULL)
1197  xmlFree(style->methodURI);
1198  style->methodURI = NULL;
1199 
1200  /*
1201  * TODO: Don't use xsltGetQNameURI().
1202  */
1203  URI = xsltGetQNameURI(cur, &prop);
1204  if (prop == NULL) {
1205  if (style != NULL) style->errors++;
1206  } else if (URI == NULL) {
1207  if ((xmlStrEqual(prop, (const xmlChar *) "xml")) ||
1208  (xmlStrEqual(prop, (const xmlChar *) "html")) ||
1209  (xmlStrEqual(prop, (const xmlChar *) "text"))) {
1210  style->method = prop;
1211  } else {
1213  "invalid value for method: %s\n", prop);
1214  if (style != NULL) style->warnings++;
1215  xmlFree(prop);
1216  }
1217  } else {
1218  style->method = prop;
1219  style->methodURI = xmlStrdup(URI);
1220  }
1221  }
1222 
1223  prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-system", NULL);
1224  if (prop != NULL) {
1225  if (style->doctypeSystem != NULL)
1226  xmlFree(style->doctypeSystem);
1227  style->doctypeSystem = prop;
1228  }
1229 
1230  prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-public", NULL);
1231  if (prop != NULL) {
1232  if (style->doctypePublic != NULL)
1233  xmlFree(style->doctypePublic);
1234  style->doctypePublic = prop;
1235  }
1236 
1237  prop = xmlGetNsProp(cur, (const xmlChar *) "standalone", NULL);
1238  if (prop != NULL) {
1239  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1240  style->standalone = 1;
1241  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1242  style->standalone = 0;
1243  } else {
1245  "invalid value for standalone: %s\n", prop);
1246  style->errors++;
1247  }
1248  xmlFree(prop);
1249  }
1250 
1251  prop = xmlGetNsProp(cur, (const xmlChar *) "indent", NULL);
1252  if (prop != NULL) {
1253  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1254  style->indent = 1;
1255  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1256  style->indent = 0;
1257  } else {
1259  "invalid value for indent: %s\n", prop);
1260  style->errors++;
1261  }
1262  xmlFree(prop);
1263  }
1264 
1265  prop = xmlGetNsProp(cur, (const xmlChar *) "omit-xml-declaration", NULL);
1266  if (prop != NULL) {
1267  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1268  style->omitXmlDeclaration = 1;
1269  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1270  style->omitXmlDeclaration = 0;
1271  } else {
1273  "invalid value for omit-xml-declaration: %s\n",
1274  prop);
1275  style->errors++;
1276  }
1277  xmlFree(prop);
1278  }
1279 
1280  elements = xmlGetNsProp(cur, (const xmlChar *) "cdata-section-elements",
1281  NULL);
1282  if (elements != NULL) {
1283  if (style->cdataSection == NULL)
1284  style->cdataSection = xmlHashCreate(10);
1285  if (style->cdataSection == NULL)
1286  return;
1287 
1288  element = elements;
1289  while (*element != 0) {
1290  while (IS_BLANK(*element))
1291  element++;
1292  if (*element == 0)
1293  break;
1294  end = element;
1295  while ((*end != 0) && (!IS_BLANK(*end)))
1296  end++;
1298  if (element) {
1299 #ifdef WITH_XSLT_DEBUG_PARSING
1301  "add cdata section output element %s\n",
1302  element);
1303 #endif
1304  if (xmlValidateQName(BAD_CAST element, 0) != 0) {
1306  "Attribute 'cdata-section-elements': The value "
1307  "'%s' is not a valid QName.\n", element);
1308  xmlFree(element);
1309  style->errors++;
1310  } else {
1311  const xmlChar *URI;
1312 
1313  /*
1314  * TODO: Don't use xsltGetQNameURI().
1315  */
1316  URI = xsltGetQNameURI(cur, &element);
1317  if (element == NULL) {
1318  /*
1319  * TODO: We'll report additionally an error
1320  * via the stylesheet's error handling.
1321  */
1323  "Attribute 'cdata-section-elements': The value "
1324  "'%s' is not a valid QName.\n", element);
1325  style->errors++;
1326  } else {
1327  xmlNsPtr ns;
1328 
1329  /*
1330  * XSLT-1.0 "Each QName is expanded into an
1331  * expanded-name using the namespace declarations in
1332  * effect on the xsl:output element in which the QName
1333  * occurs; if there is a default namespace, it is used
1334  * for QNames that do not have a prefix"
1335  * NOTE: Fix of bug #339570.
1336  */
1337  if (URI == NULL) {
1338  ns = xmlSearchNs(style->doc, cur, NULL);
1339  if (ns != NULL)
1340  URI = ns->href;
1341  }
1342  xmlHashAddEntry2(style->cdataSection, element, URI,
1343  (void *) "cdata");
1344  xmlFree(element);
1345  }
1346  }
1347  }
1348  element = end;
1349  }
1350  xmlFree(elements);
1351  }
1352 
1353  prop = xmlGetNsProp(cur, (const xmlChar *) "media-type", NULL);
1354  if (prop != NULL) {
1355  if (style->mediaType)
1356  xmlFree(style->mediaType);
1357  style->mediaType = prop;
1358  }
1359  if (cur->children != NULL) {
1361  }
1362 }
Definition: tree.h:389
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
GLuint GLuint end
Definition: gl.h:1545
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
xmlElementType type
Definition: tree.h:491
struct _xmlNode * children
Definition: tree.h:493
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
Arabic default style
Definition: afstyles.h:93
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
static void xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node)
Definition: xslt.c:97
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetPI()

static xmlChar* xsltParseStylesheetPI ( const xmlChar value)
static

xsltParseStylesheetPI: @value: the value of the PI

This function checks that the type is text/xml and extracts the URI-Reference for the stylesheet

Returns the URI-Reference for the stylesheet or NULL (it need to be freed by the caller)

Definition at line 6785 of file xslt.c.

6785  {
6786  const xmlChar *cur;
6787  const xmlChar *start;
6788  xmlChar *val;
6789  xmlChar tmp;
6790  xmlChar *href = NULL;
6791  int isXml = 0;
6792 
6793  if (value == NULL)
6794  return(NULL);
6795 
6796  cur = value;
6797  while (CUR != 0) {
6798  SKIP_BLANKS;
6799  if ((CUR == 't') && (NXT(1) == 'y') && (NXT(2) == 'p') &&
6800  (NXT(3) == 'e')) {
6801  SKIP(4);
6802  SKIP_BLANKS;
6803  if (CUR != '=')
6804  continue;
6805  NEXT;
6806  if ((CUR != '\'') && (CUR != '"'))
6807  continue;
6808  tmp = CUR;
6809  NEXT;
6810  start = cur;
6811  while ((CUR != 0) && (CUR != tmp))
6812  NEXT;
6813  if (CUR != tmp)
6814  continue;
6815  val = xmlStrndup(start, cur - start);
6816  NEXT;
6817  if (val == NULL)
6818  return(NULL);
6819  if ((xmlStrcasecmp(val, BAD_CAST "text/xml")) &&
6820  (xmlStrcasecmp(val, BAD_CAST "text/xsl"))) {
6821  xmlFree(val);
6822  break;
6823  }
6824  isXml = 1;
6825  xmlFree(val);
6826  } else if ((CUR == 'h') && (NXT(1) == 'r') && (NXT(2) == 'e') &&
6827  (NXT(3) == 'f')) {
6828  SKIP(4);
6829  SKIP_BLANKS;
6830  if (CUR != '=')
6831  continue;
6832  NEXT;
6833  if ((CUR != '\'') && (CUR != '"'))
6834  continue;
6835  tmp = CUR;
6836  NEXT;
6837  start = cur;
6838  while ((CUR != 0) && (CUR != tmp))
6839  NEXT;
6840  if (CUR != tmp)
6841  continue;
6842  if (href == NULL)
6843  href = xmlStrndup(start, cur - start);
6844  NEXT;
6845  } else {
6846  while ((CUR != 0) && (!IS_BLANK(CUR)))
6847  NEXT;
6848  }
6849 
6850  }
6851 
6852  if (!isXml) {
6853  if (href != NULL)
6854  xmlFree(href);
6855  href = NULL;
6856  }
6857  return(href);
6858 }
#define CUR
Definition: xslt.c:6767
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
#define SKIP(val)
Definition: xslt.c:6768
#define SKIP_BLANKS
Definition: xslt.c:6770
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
GLuint GLfloat * val
Definition: glext.h:7180
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
#define NEXT
Definition: xslt.c:6772
GLsizei const GLfloat * value
Definition: glext.h:6069
#define NXT(val)
Definition: xslt.c:6769
GLuint start
Definition: gl.h:1545
XMLPUBFUN int XMLCALL xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:271

Referenced by xsltLoadStylesheetPI().

◆ xsltParseStylesheetPreserveSpace()

static void xsltParseStylesheetPreserveSpace ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)
static

xsltParseStylesheetPreserveSpace: @style: the XSLT stylesheet @cur: the "preserve-space" element

parse an XSLT stylesheet preserve-space element and record elements needing preserving

Definition at line 1507 of file xslt.c.

1507  {
1508  xmlChar *elements;
1509  xmlChar *element, *end;
1510 
1511  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1512  return;
1513 
1514  elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
1515  if (elements == NULL) {
1517  "xsltParseStylesheetPreserveSpace: missing elements attribute\n");
1518  if (style != NULL) style->warnings++;
1519  return;
1520  }
1521 
1522  if (style->stripSpaces == NULL)
1523  style->stripSpaces = xmlHashCreate(10);
1524  if (style->stripSpaces == NULL)
1525  return;
1526 
1527  element = elements;
1528  while (*element != 0) {
1529  while (IS_BLANK(*element)) element++;
1530  if (*element == 0)
1531  break;
1532  end = element;
1533  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1535  if (element) {
1536 #ifdef WITH_XSLT_DEBUG_PARSING
1538  "add preserved space element %s\n", element);
1539 #endif
1540  if (xmlStrEqual(element, (const xmlChar *)"*")) {
1541  style->stripAll = -1;
1542  } else {
1543  const xmlChar *URI;
1544 
1545  /*
1546  * TODO: Don't use xsltGetQNameURI().
1547  */
1548  URI = xsltGetQNameURI(cur, &element);
1549 
1550  xmlHashAddEntry2(style->stripSpaces, element, URI,
1551  (xmlChar *) "preserve");
1552  }
1553  xmlFree(element);
1554  }
1555  element = end;
1556  }
1557  xmlFree(elements);
1558  if (cur->children != NULL) {
1560  }
1561 }
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
GLuint GLuint end
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
xmlElementType type
Definition: tree.h:491
struct _xmlNode * children
Definition: tree.h:493
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
Arabic default style
Definition: afstyles.h:93
static void xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node)
Definition: xslt.c:97
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetProcess()

xsltStylesheetPtr xsltParseStylesheetProcess ( xsltStylesheetPtr  ret,
xmlDocPtr  doc 
)

xsltParseStylesheetProcess: @ret: the XSLT stylesheet (the current stylesheet-level) @doc: and xmlDoc parsed XML

Parses an XSLT stylesheet, adding the associated structures. Called by: xsltParseStylesheetImportedDoc() (xslt.c) xsltParseStylesheetInclude() (imports.c)

Returns the value of the @style parameter if everything went right, NULL if something went amiss.

Definition at line 6391 of file xslt.c.

6391  {
6392  xmlNodePtr cur;
6393 
6394  xsltInitGlobals();
6395 
6396  if (doc == NULL)
6397  return(NULL);
6398  if (ret == NULL)
6399  return(ret);
6400 
6401  /*
6402  * First steps, remove blank nodes,
6403  * locate the xsl:stylesheet element and the
6404  * namespace declaration.
6405  */
6406  cur = xmlDocGetRootElement(doc);
6407  if (cur == NULL) {
6409  "xsltParseStylesheetProcess : empty stylesheet\n");
6410  return(NULL);
6411  }
6412 
6413  if ((IS_XSLT_ELEM(cur)) &&
6414  ((IS_XSLT_NAME(cur, "stylesheet")) ||
6415  (IS_XSLT_NAME(cur, "transform")))) {
6416 #ifdef WITH_XSLT_DEBUG_PARSING
6418  "xsltParseStylesheetProcess : found stylesheet\n");
6419 #endif
6420  ret->literal_result = 0;
6423  } else {
6426  ret->literal_result = 1;
6427  }
6428  if (!ret->nopreproc) {
6430  }
6431  if (ret->literal_result == 0) {
6433  } else {
6434  xmlChar *prop;
6435  xsltTemplatePtr template;
6436 
6437  /*
6438  * the document itself might be the template, check xsl:version
6439  */
6440  prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
6441  if (prop == NULL) {
6442  xsltTransformError(NULL, ret, cur,
6443  "xsltParseStylesheetProcess : document is not a stylesheet\n");
6444  return(NULL);
6445  }
6446 
6447 #ifdef WITH_XSLT_DEBUG_PARSING
6449  "xsltParseStylesheetProcess : document is stylesheet\n");
6450 #endif
6451 
6452  if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
6453  (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
6454  xsltTransformError(NULL, ret, cur,
6455  "xsl:version: only 1.1 features are supported\n");
6456  ret->forwards_compatible = 1;
6457  ret->warnings++;
6458  }
6459  xmlFree(prop);
6460 
6461  /*
6462  * Create and link the template
6463  */
6464  template = xsltNewTemplate();
6465  if (template == NULL) {
6466  return(NULL);
6467  }
6468  template->next = ret->templates;
6469  ret->templates = template;
6470  template->match = xmlStrdup((const xmlChar *)"/");
6471 
6472  /*
6473  * parse the content and register the pattern
6474  */
6476  template->elem = (xmlNodePtr) doc;
6477  template->content = doc->children;
6478  xsltAddTemplate(ret, template, NULL, NULL);
6479  ret->literal_result = 1;
6480  }
6481 
6482  return(ret);
6483 }
int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:2085
#define XSLT_NAMESPACE
Definition: xslt.h:46
static void xsltPreprocessStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:3450
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
smooth NULL
Definition: ftsmooth.c:416
xmlNode * xmlNodePtr
Definition: tree.h:488
static void xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur, int isXsltElem)
Definition: xslt.c:1580
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
static int xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur, int isXsltElem)
Definition: xslt.c:1716
Definition: tree.h:489
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
static xsltTemplatePtr xsltNewTemplate(void)
Definition: xslt.c:394
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
struct _xmlNode * children
Definition: tree.h:555
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
void xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ)
Definition: xslt.c:4863
void xsltInitGlobals(void)
Definition: extensions.c:2263
#define IS_XSLT_NAME(n, val)
Definition: xsltutils.h:63
static void xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top)
Definition: xslt.c:6063
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xsltParseStylesheetImportedDoc(), and xsltParseStylesheetInclude().

◆ xsltParseStylesheetStripSpace()

static void xsltParseStylesheetStripSpace ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)
static

xsltParseStylesheetStripSpace: @style: the XSLT stylesheet @cur: the "strip-space" element

parse an XSLT stylesheet's strip-space element and record the elements needing stripping

Definition at line 1646 of file xslt.c.

1646  {
1647  xmlChar *elements;
1648  xmlChar *element, *end;
1649 
1650  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1651  return;
1652 
1653  elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
1654  if (elements == NULL) {
1656  "xsltParseStylesheetStripSpace: missing elements attribute\n");
1657  if (style != NULL) style->warnings++;
1658  return;
1659  }
1660 
1661  if (style->stripSpaces == NULL)
1662  style->stripSpaces = xmlHashCreate(10);
1663  if (style->stripSpaces == NULL)
1664  return;
1665 
1666  element = elements;
1667  while (*element != 0) {
1668  while (IS_BLANK(*element)) element++;
1669  if (*element == 0)
1670  break;
1671  end = element;
1672  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1674  if (element) {
1675 #ifdef WITH_XSLT_DEBUG_PARSING
1677  "add stripped space element %s\n", element);
1678 #endif
1679  if (xmlStrEqual(element, (const xmlChar *)"*")) {
1680  style->stripAll = 1;
1681  } else {
1682  const xmlChar *URI;
1683 
1684  /*
1685  * TODO: Don't use xsltGetQNameURI().
1686  */
1687  URI = xsltGetQNameURI(cur, &element);
1688 
1689  xmlHashAddEntry2(style->stripSpaces, element, URI,
1690  (xmlChar *) "strip");
1691  }
1692  xmlFree(element);
1693  }
1694  element = end;
1695  }
1696  xmlFree(elements);
1697  if (cur->children != NULL) {
1699  }
1700 }
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
Definition: xmlstring.c:41
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
GLuint GLuint end
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
unsigned char xmlChar
Definition: xmlstring.h:28
#define IS_BLANK(c)
Definition: xslt.c:79
xmlElementType type
Definition: tree.h:491
struct _xmlNode * children
Definition: tree.h:493
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
Arabic default style
Definition: afstyles.h:93
static void xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node)
Definition: xslt.c:97
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetTemplate()

static void xsltParseStylesheetTemplate ( xsltStylesheetPtr  style,
xmlNodePtr  template 
)
static

xsltParseStylesheetTemplate: @style: the XSLT stylesheet @template: the "template" element

parse an XSLT stylesheet template building the associated structures

Definition at line 5335 of file xslt.c.

5335  {
5337  xmlChar *prop;
5338  xmlChar *mode = NULL;
5339  xmlChar *modeURI = NULL;
5340  double priority;
5341 
5342  if ((style == NULL) || (template == NULL) ||
5343  (template->type != XML_ELEMENT_NODE))
5344  return;
5345 
5346  /*
5347  * Create and link the structure
5348  */
5349  ret = xsltNewTemplate();
5350  if (ret == NULL)
5351  return;
5352  ret->next = style->templates;
5353  style->templates = ret;
5354  ret->style = style;
5355 
5356  /*
5357  * Get inherited namespaces
5358  */
5359  /*
5360  * TODO: Apply the optimized in-scope-namespace mechanism
5361  * as for the other XSLT instructions.
5362  */
5363  xsltGetInheritedNsList(style, ret, template);
5364 
5365  /*
5366  * Get arguments
5367  */
5368  prop = xmlGetNsProp(template, (const xmlChar *)"mode", NULL);
5369  if (prop != NULL) {
5370  const xmlChar *URI;
5371 
5372  /*
5373  * TODO: Don't use xsltGetQNameURI().
5374  */
5375  URI = xsltGetQNameURI(template, &prop);
5376  if (prop == NULL) {
5377  if (style != NULL) style->errors++;
5378  goto error;
5379  } else {
5380  mode = prop;
5381  if (URI != NULL)
5382  modeURI = xmlStrdup(URI);
5383  }
5384  ret->mode = xmlDictLookup(style->dict, mode, -1);
5385  ret->modeURI = xmlDictLookup(style->dict, modeURI, -1);
5386 #ifdef WITH_XSLT_DEBUG_PARSING
5388  "xsltParseStylesheetTemplate: mode %s\n", mode);
5389 #endif
5390  if (mode != NULL) xmlFree(mode);
5391  if (modeURI != NULL) xmlFree(modeURI);
5392  }
5393  prop = xmlGetNsProp(template, (const xmlChar *)"match", NULL);
5394  if (prop != NULL) {
5395  if (ret->match != NULL) xmlFree(ret->match);
5396  ret->match = prop;
5397  }
5398 
5399  prop = xmlGetNsProp(template, (const xmlChar *)"priority", NULL);
5400  if (prop != NULL) {
5402  ret->priority = (float) priority;
5403  xmlFree(prop);
5404  }
5405 
5406  prop = xmlGetNsProp(template, (const xmlChar *)"name", NULL);
5407  if (prop != NULL) {
5408  const xmlChar *URI;
5409 
5410  /*
5411  * TODO: Don't use xsltGetQNameURI().
5412  */
5413  URI = xsltGetQNameURI(template, &prop);
5414  if (prop == NULL) {
5415  if (style != NULL) style->errors++;
5416  goto error;
5417  } else {
5418  if (xmlValidateNCName(prop,0)) {
5419  xsltTransformError(NULL, style, template,
5420  "xsl:template : error invalid name '%s'\n", prop);
5421  if (style != NULL) style->errors++;
5422  xmlFree(prop);
5423  goto error;
5424  }
5425  ret->name = xmlDictLookup(style->dict, BAD_CAST prop, -1);
5426  xmlFree(prop);
5427  prop = NULL;
5428  if (URI != NULL)
5429  ret->nameURI = xmlDictLookup(style->dict, BAD_CAST URI, -1);
5430  else
5431  ret->nameURI = NULL;
5432  }
5433  }
5434 
5435  /*
5436  * parse the content and register the pattern
5437  */
5438  xsltParseTemplateContent(style, template);
5439  ret->elem = template;
5440  ret->content = template->children;
5441  xsltAddTemplate(style, ret, ret->mode, ret->modeURI);
5442 
5443 error:
5444  return;
5445 }
#define error(str)
Definition: mkdosfs.c:1605
int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:2085
static int xsltGetInheritedNsList(xsltStylesheetPtr style, xsltTemplatePtr template, xmlNodePtr node)
Definition: xslt.c:1067
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum mode
Definition: glext.h:6217
const UINT template
Definition: action.c:7785
static xsltTemplatePtr xsltNewTemplate(void)
Definition: xslt.c:394
static int priority
Definition: timer.c:163
double xmlXPathStringEvalNumber(const xmlChar *str)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
void xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ)
Definition: xslt.c:4863
Arabic default style
Definition: afstyles.h:93
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
const xmlChar * xsltGetQNameURI(xmlNodePtr node, xmlChar **name)
Definition: xsltutils.c:753

Referenced by xsltParseStylesheetTop().

◆ xsltParseStylesheetTop()

static void xsltParseStylesheetTop ( xsltStylesheetPtr  style,
xmlNodePtr  top 
)
static

xsltParseStylesheetTop: @style: the XSLT stylesheet @top: the top level "stylesheet" or "transform" element

scan the top level elements of an XSL stylesheet

Definition at line 6063 of file xslt.c.

6063  {
6064  xmlNodePtr cur;
6065  xmlChar *prop;
6066 #ifdef WITH_XSLT_DEBUG_PARSING
6067  int templates = 0;
6068 #endif
6069 
6070  if ((top == NULL) || (top->type != XML_ELEMENT_NODE))
6071  return;
6072 
6073  prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL);
6074  if (prop == NULL) {
6076  "xsl:version is missing: document may not be a stylesheet\n");
6077  if (style != NULL) style->warnings++;
6078  } else {
6079  if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
6080  (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
6082  "xsl:version: only 1.1 features are supported\n");
6083  if (style != NULL) {
6084  style->forwards_compatible = 1;
6085  style->warnings++;
6086  }
6087  }
6088  xmlFree(prop);
6089  }
6090 
6091  /*
6092  * process xsl:import elements
6093  */
6094  cur = top->children;
6095  while (cur != NULL) {
6096  if (IS_BLANK_NODE(cur)) {
6097  cur = cur->next;
6098  continue;
6099  }
6100  if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "import")) {
6101  if (xsltParseStylesheetImport(style, cur) != 0)
6102  if (style != NULL) style->errors++;
6103  } else
6104  break;
6105  cur = cur->next;
6106  }
6107 
6108  /*
6109  * process other top-level elements
6110  */
6111  while (cur != NULL) {
6112  if (IS_BLANK_NODE(cur)) {
6113  cur = cur->next;
6114  continue;
6115  }
6116  if (cur->type == XML_TEXT_NODE) {
6117  if (cur->content != NULL) {
6119  "misplaced text node: '%s'\n", cur->content);
6120  }
6121  if (style != NULL) style->errors++;
6122  cur = cur->next;
6123  continue;
6124  }
6125  if ((cur->type == XML_ELEMENT_NODE) && (cur->ns == NULL)) {
6127  "Found a top-level element %s with null namespace URI\n",
6128  cur->name);
6129  if (style != NULL) style->errors++;
6130  cur = cur->next;
6131  continue;
6132  }
6133  if ((cur->type == XML_ELEMENT_NODE) && (!(IS_XSLT_ELEM(cur)))) {
6134  xsltTopLevelFunction function;
6135 
6136  function = xsltExtModuleTopLevelLookup(cur->name,
6137  cur->ns->href);
6138  if (function != NULL)
6139  function(style, cur);
6140 
6141 #ifdef WITH_XSLT_DEBUG_PARSING
6143  "xsltParseStylesheetTop : found foreign element %s\n",
6144  cur->name);
6145 #endif
6146  cur = cur->next;
6147  continue;
6148  }
6149  if (IS_XSLT_NAME(cur, "import")) {
6151  "xsltParseStylesheetTop: ignoring misplaced import element\n");
6152  if (style != NULL) style->errors++;
6153  } else if (IS_XSLT_NAME(cur, "include")) {
6154  if (xsltParseStylesheetInclude(style, cur) != 0)
6155  if (style != NULL) style->errors++;
6156  } else if (IS_XSLT_NAME(cur, "strip-space")) {
6158  } else if (IS_XSLT_NAME(cur, "preserve-space")) {
6160  } else if (IS_XSLT_NAME(cur, "output")) {
6162  } else if (IS_XSLT_NAME(cur, "key")) {
6164  } else if (IS_XSLT_NAME(cur, "decimal-format")) {
6166  } else if (IS_XSLT_NAME(cur, "attribute-set")) {
6168  } else if (IS_XSLT_NAME(cur, "variable")) {
6170  } else if (IS_XSLT_NAME(cur, "param")) {
6172  } else if (IS_XSLT_NAME(cur, "template")) {
6173 #ifdef WITH_XSLT_DEBUG_PARSING
6174  templates++;
6175 #endif
6177  } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
6178  xsltNamespaceAlias(style, cur);
6179  } else {
6180  if ((style != NULL) && (style->forwards_compatible == 0)) {
6182  "xsltParseStylesheetTop: unknown %s element\n",
6183  cur->name);
6184  if (style != NULL) style->errors++;
6185  }
6186  }
6187  cur = cur->next;
6188  }
6189 #ifdef WITH_XSLT_DEBUG_PARSING
6191  "parsed %d templates\n", templates);
6192 #endif
6193 }
void xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: variables.c:2082
void xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1162
xsltTopLevelFunction xsltExtModuleTopLevelLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1856
const xmlChar * name
Definition: tree.h:492
#define IS_BLANK_NODE(n)
Definition: xslt.c:85
static void xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1646
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
int xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: imports.c:146
smooth NULL
Definition: ftsmooth.c:416
static void xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template)
Definition: xslt.c:5335
void * xsltGenericDebugContext
Definition: xsltutils.c:549
static void xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1507
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
xmlChar * content
Definition: tree.h:502
void * xsltGenericErrorContext
Definition: xsltutils.c:503
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28
xmlElementType type
Definition: tree.h:491
struct _xmlNode * next
Definition: tree.h:496
void(* xsltTopLevelFunction)(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.h:183
struct _xmlNode * children
Definition: tree.h:493
static void xsltParseStylesheetKey(xsltStylesheetPtr style, xmlNodePtr key)
Definition: xslt.c:5083
int xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: imports.c:49
static void xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1380
xmlNs * ns
Definition: tree.h:501
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
void xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
Definition: namespaces.c:55
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
char templates[]
Definition: meshbuilder.c:42
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93
void xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: variables.c:2019
const xmlChar * href
Definition: tree.h:392
#define IS_XSLT_NAME(n, val)
Definition: xsltutils.h:63
void xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: attributes.c:348

Referenced by xsltParseStylesheetProcess().

◆ xsltParseTemplateContent()

void xsltParseTemplateContent ( xsltStylesheetPtr  style,
xmlNodePtr  templ 
)

xsltParseTemplateContent: @style: the XSLT stylesheet @templ: the container node (can be a document for literal results)

parse a template content-model Clean-up the template content from unwanted ignorable blank nodes and process xslt:text

Definition at line 4863 of file xslt.c.

4863  {
4864  xmlNodePtr cur, delete;
4865 
4866  if ((style == NULL) || (templ == NULL) ||
4867  (templ->type == XML_NAMESPACE_DECL)) return;
4868 
4869  /*
4870  * This content comes from the stylesheet
4871  * For stylesheets, the set of whitespace-preserving
4872  * element names consists of just xsl:text.
4873  */
4874  cur = templ->children;
4875  delete = NULL;
4876  while (cur != NULL) {
4877  if (delete != NULL) {
4878 #ifdef WITH_XSLT_DEBUG_BLANKS
4880  "xsltParseTemplateContent: removing text\n");
4881 #endif
4882  xmlUnlinkNode(delete);
4883  xmlFreeNode(delete);
4884  delete = NULL;
4885  }
4886  if (IS_XSLT_ELEM(cur)) {
4887  xsltStylePreCompute(style, cur);
4888 
4889  if (IS_XSLT_NAME(cur, "text")) {
4890  /*
4891  * TODO: Processing of xsl:text should be moved to
4892  * xsltPreprocessStylesheet(), since otherwise this
4893  * will be performed for every multiply included
4894  * stylesheet; i.e. this here is not skipped with
4895  * the use of the style->nopreproc flag.
4896  */
4897  if (cur->children != NULL) {
4898  xmlChar *prop;
4899  xmlNodePtr text = cur->children, next;
4900  int noesc = 0;
4901 
4902  prop = xmlGetNsProp(cur,
4903  (const xmlChar *)"disable-output-escaping",
4904  NULL);
4905  if (prop != NULL) {
4906 #ifdef WITH_XSLT_DEBUG_PARSING
4908  "Disable escaping: %s\n", text->content);
4909 #endif
4910  if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
4911  noesc = 1;
4912  } else if (!xmlStrEqual(prop,
4913  (const xmlChar *)"no")){
4915  "xsl:text: disable-output-escaping allows only yes or no\n");
4916  style->warnings++;
4917 
4918  }
4919  xmlFree(prop);
4920  }
4921 
4922  while (text != NULL) {
4923  if (text->type == XML_COMMENT_NODE) {
4924  text = text->next;
4925  continue;
4926  }
4927  if ((text->type != XML_TEXT_NODE) &&
4928  (text->type != XML_CDATA_SECTION_NODE)) {
4930  "xsltParseTemplateContent: xslt:text content problem\n");
4931  style->errors++;
4932  break;
4933  }
4934  if ((noesc) && (text->type != XML_CDATA_SECTION_NODE))
4935  text->name = xmlStringTextNoenc;
4936  text = text->next;
4937  }
4938 
4939  /*
4940  * replace xsl:text by the list of childs
4941  */
4942  if (text == NULL) {
4943  text = cur->children;
4944  while (text != NULL) {
4945  if ((style->internalized) &&
4946  (text->content != NULL) &&
4947  (!xmlDictOwns(style->dict, text->content))) {
4948 
4949  /*
4950  * internalize the text string
4951  */
4952  if (text->doc->dict != NULL) {
4953  const xmlChar *tmp;
4954 
4955  tmp = xmlDictLookup(text->doc->dict,
4956  text->content, -1);
4957  if (tmp != text->content) {
4959  text->content = (xmlChar *) tmp;
4960  }
4961  }
4962  }
4963 
4964  next = text->next;
4966  xmlAddPrevSibling(cur, text);
4967  text = next;
4968  }
4969  }
4970  }
4971  delete = cur;
4972  goto skip_children;
4973  }
4974  }
4975  else if ((cur->ns != NULL) && (style->nsDefs != NULL) &&
4976  (xsltCheckExtPrefix(style, cur->ns->prefix)))
4977  {
4978  /*
4979  * okay this is an extension element compile it too
4980  */
4981  xsltStylePreCompute(style, cur);
4982  }
4983  else if (cur->type == XML_ELEMENT_NODE)
4984  {
4985  /*
4986  * This is an element which will be output as part of the
4987  * template exectution, precompile AVT if found.
4988  */
4989  if ((cur->ns == NULL) && (style->defaultAlias != NULL)) {
4990  cur->ns = xmlSearchNsByHref(cur->doc, cur,
4991  style->defaultAlias);
4992  }
4993  if (cur->properties != NULL) {
4994  xmlAttrPtr attr = cur->properties;
4995 
4996  while (attr != NULL) {
4998  attr = attr->next;
4999  }
5000  }
5001  }
5002  /*
5003  * Skip to next node
5004  */
5005  if (cur->children != NULL) {
5006  if (cur->children->type != XML_ENTITY_DECL) {
5007  cur = cur->children;
5008  continue;
5009  }
5010  }
5011 skip_children:
5012  if (cur->next != NULL) {
5013  cur = cur->next;
5014  continue;
5015  }
5016 
5017  do {
5018  cur = cur->parent;
5019  if (cur == NULL)
5020  break;
5021  if (cur == templ) {
5022  cur = NULL;
5023  break;
5024  }
5025  if (cur->next != NULL) {
5026  cur = cur->next;
5027  break;
5028  }
5029  } while (cur != NULL);
5030  }
5031  if (delete != NULL) {
5032 #ifdef WITH_XSLT_DEBUG_PARSING
5034  "xsltParseTemplateContent: removing text\n");
5035 #endif
5036  xmlUnlinkNode(delete);
5037  xmlFreeNode(delete);
5038  delete = NULL;
5039  }
5040 
5041  /*
5042  * Skip the first params
5043  */
5044  cur = templ->children;
5045  while (cur != NULL) {
5046  if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param"))))
5047  break;
5048  cur = cur->next;
5049  }
5050 
5051  /*
5052  * Browse the remainder of the template
5053  */
5054  while (cur != NULL) {
5055  if ((IS_XSLT_ELEM(cur)) && (IS_XSLT_NAME(cur, "param"))) {
5056  xmlNodePtr param = cur;
5057 
5059  "xsltParseTemplateContent: ignoring misplaced param element\n");
5060  if (style != NULL) style->warnings++;
5061  cur = cur->next;
5063  xmlFreeNode(param);
5064  } else
5065  break;
5066  }
5067 }
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href)
const WCHAR * text
Definition: package.c:1827
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
struct _xmlDoc * doc
Definition: tree.h:498
smooth NULL
Definition: ftsmooth.c:416
void xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:2175
struct _xmlNode * parent
Definition: tree.h:495
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
GLfloat param
Definition: glext.h:5796
int xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1158
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
Definition: cookie.c:170
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
Definition: tree.h:489
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlAttr * properties
Definition: tree.h:503
xmlElementType type
Definition: tree.h:491
XMLPUBFUN void XMLCALL xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content)
static unsigned __int64 next
Definition: rand_nt.c:6
struct _xmlNode * next
Definition: tree.h:496
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
XMLPUBVAR const xmlChar xmlStringTextNoenc[]
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
struct _xmlNode * children
Definition: tree.h:493
Definition: tree.h:434
xmlNs * ns
Definition: tree.h:501
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
const xmlChar * prefix
Definition: tree.h:393
Arabic default style
Definition: afstyles.h:93
#define IS_XSLT_NAME(n, val)
Definition: xsltutils.h:63
void xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr)
Definition: attrvt.c:159

Referenced by xsltParseGlobalParam(), xsltParseGlobalVariable(), xsltParseStylesheetAttributeSet(), xsltParseStylesheetProcess(), and xsltParseStylesheetTemplate().

◆ xsltPreprocessStylesheet()

static void xsltPreprocessStylesheet ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)
static

Definition at line 3450 of file xslt.c.

3451 {
3452  xmlNodePtr deleteNode, styleelem;
3453  int internalize = 0;
3454 
3455  if ((style == NULL) || (cur == NULL))
3456  return;
3457 
3458  if ((cur->doc != NULL) && (style->dict != NULL) &&
3459  (cur->doc->dict == style->dict))
3460  internalize = 1;
3461  else
3462  style->internalized = 0;
3463 
3464  if ((cur != NULL) && (IS_XSLT_ELEM(cur)) &&
3465  (IS_XSLT_NAME(cur, "stylesheet"))) {
3466  styleelem = cur;
3467  } else {
3468  styleelem = NULL;
3469  }
3470 
3471  /*
3472  * This content comes from the stylesheet
3473  * For stylesheets, the set of whitespace-preserving
3474  * element names consists of just xsl:text.
3475  */
3476  deleteNode = NULL;
3477  while (cur != NULL) {
3478  if (deleteNode != NULL) {
3479 #ifdef WITH_XSLT_DEBUG_BLANKS
3481  "xsltPreprocessStylesheet: removing ignorable blank node\n");
3482 #endif
3483  xmlUnlinkNode(deleteNode);
3484  xmlFreeNode(deleteNode);
3485  deleteNode = NULL;
3486  }
3487  if (cur->type == XML_ELEMENT_NODE) {
3488  int exclPrefixes;
3489  /*
3490  * Internalize attributes values.
3491  */
3492  if ((internalize) && (cur->properties != NULL)) {
3493  xmlAttrPtr attr = cur->properties;
3494  xmlNodePtr txt;
3495 
3496  while (attr != NULL) {
3497  txt = attr->children;
3498  if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
3499  (txt->content != NULL) &&
3500  (!xmlDictOwns(style->dict, txt->content)))
3501  {
3502  xmlChar *tmp;
3503 
3504  /*
3505  * internalize the text string, goal is to speed
3506  * up operations and minimize used space by compiled
3507  * stylesheets.
3508  */
3509  tmp = (xmlChar *) xmlDictLookup(style->dict,
3510  txt->content, -1);
3511  if (tmp != txt->content) {
3512  xmlNodeSetContent(txt, NULL);
3513  txt->content = tmp;
3514  }
3515  }
3516  attr = attr->next;
3517  }
3518  }
3519  if (IS_XSLT_ELEM(cur)) {
3520  exclPrefixes = 0;
3521  if (IS_XSLT_NAME(cur, "text")) {
3522  for (;exclPrefixes > 0;exclPrefixes--)
3524  goto skip_children;
3525  }
3526  } else {
3527  exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0);
3528  }
3529 
3530  if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) {
3531  xmlNsPtr ns = cur->nsDef, prev = NULL, next;
3532  xmlNodePtr root = NULL;
3533  int i, moved;
3534 
3535  root = xmlDocGetRootElement(cur->doc);
3536  if ((root != NULL) && (root != cur)) {
3537  while (ns != NULL) {
3538  moved = 0;
3539  next = ns->next;
3540  for (i = 0;i < style->exclPrefixNr;i++) {
3541  if ((ns->prefix != NULL) &&
3542  (xmlStrEqual(ns->href,
3543  style->exclPrefixTab[i]))) {
3544  /*
3545  * Move the namespace definition on the root
3546  * element to avoid duplicating it without
3547  * loosing it.
3548  */
3549  if (prev == NULL) {
3550  cur->nsDef = ns->next;
3551  } else {
3552  prev->next = ns->next;
3553  }
3554  ns->next = root->nsDef;
3555  root->nsDef = ns;
3556  moved = 1;
3557  break;
3558  }
3559  }
3560  if (moved == 0)
3561  prev = ns;
3562  ns = next;
3563  }
3564  }
3565  }
3566  /*
3567  * If we have prefixes locally, recurse and pop them up when
3568  * going back
3569  */
3570  if (exclPrefixes > 0) {
3572  for (;exclPrefixes > 0;exclPrefixes--)
3574  goto skip_children;
3575  }
3576  } else if (cur->type == XML_TEXT_NODE) {
3577  if (IS_BLANK_NODE(cur)) {
3578  if (xmlNodeGetSpacePreserve(cur->parent) != 1) {
3579  deleteNode = cur;
3580  }
3581  } else if ((cur->content != NULL) && (internalize) &&
3582  (!xmlDictOwns(style->dict, cur->content))) {
3583  xmlChar *tmp;
3584 
3585  /*
3586  * internalize the text string, goal is to speed
3587  * up operations and minimize used space by compiled
3588  * stylesheets.
3589  */
3590  tmp = (xmlChar *) xmlDictLookup(style->dict, cur->content, -1);
3591  xmlNodeSetContent(cur, NULL);
3592  cur->content = tmp;
3593  }
3594  } else if ((cur->type != XML_ELEMENT_NODE) &&
3595  (cur->type != XML_CDATA_SECTION_NODE)) {
3596  deleteNode = cur;
3597  goto skip_children;
3598  }
3599 
3600  /*
3601  * Skip to next node. In case of a namespaced element children of
3602  * the stylesheet and not in the XSLT namespace and not an extension
3603  * element, ignore its content.
3604  */
3605  if ((cur->type == XML_ELEMENT_NODE) && (cur->ns != NULL) &&
3606  (styleelem != NULL) && (cur->parent == styleelem) &&
3607  (!xmlStrEqual(cur->ns->href, XSLT_NAMESPACE)) &&
3608  (!xsltCheckExtURI(style, cur->ns->href))) {
3609  goto skip_children;
3610  } else if (cur->children != NULL) {
3611  if ((cur->children->type != XML_ENTITY_DECL) &&
3612  (cur->children->type != XML_ENTITY_REF_NODE) &&
3613  (cur->children->type != XML_ENTITY_NODE)) {
3614  cur = cur->children;
3615  continue;
3616  }
3617  }
3618 
3619 skip_children:
3620  if (cur->next != NULL) {
3621  cur = cur->next;
3622  continue;
3623  }
3624  do {
3625 
3626  cur = cur->parent;
3627  if (cur == NULL)
3628  break;
3629  if (cur == (xmlNodePtr) style->doc) {
3630  cur = NULL;
3631  break;
3632  }
3633  if (cur->next != NULL) {
3634  cur = cur->next;
3635  break;
3636  }
3637  } while (cur != NULL);
3638  }
3639  if (deleteNode != NULL) {
3640 #ifdef WITH_XSLT_DEBUG_PARSING
3642  "xsltPreprocessStylesheet: removing ignorable blank node\n");
3643 #endif
3644  xmlUnlinkNode(deleteNode);
3645  xmlFreeNode(deleteNode);
3646  }
3647 }
static xmlChar * exclPrefixPop(xsltStylesheetPtr style)
Definition: xslt.c:170
Definition: tree.h:389
int xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1218
#define IS_BLANK_NODE(n)
Definition: xslt.c:85
#define XSLT_NAMESPACE
Definition: xslt.h:46
static void xsltPreprocessStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:3450
xmlNs * nsDef
Definition: tree.h:504
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
struct _xmlDoc * doc
Definition: tree.h:498
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
struct _xmlNode * parent
Definition: tree.h:495
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:858
Definition: cookie.c:170
XMLPUBFUN int XMLCALL xmlNodeGetSpacePreserve(const xmlNode *cur)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
static int xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur, int isXsltElem)
Definition: xslt.c:1716
xmlChar * content
Definition: tree.h:502
Definition: tree.h:489
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlAttr * properties
Definition: tree.h:503
BSTR prefix
Definition: mxnamespace.c:46
xmlElementType type
Definition: tree.h:491
XMLPUBFUN void XMLCALL xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content)
static unsigned __int64 next
Definition: rand_nt.c:6
struct _xmlNode * next
Definition: tree.h:496
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1211
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
struct _xmlNode * children
Definition: tree.h:493
Definition: tree.h:434
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
xmlNs * ns
Definition: tree.h:501
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
#define IS_XSLT_NAME(n, val)
Definition: xsltutils.h:63

Referenced by xsltParseStylesheetProcess().

◆ xsltUninit()

void xsltUninit ( void  )

xsltUninit:

Uninitializes the processor.

Definition at line 217 of file xslt.c.

217  {
218 #ifdef XSLT_LOCALE_WINAPI
219  xmlFreeRMutex(xsltLocaleMutex);
220  xsltLocaleMutex = NULL;
221 #endif
222  initialized = 0;
223 }
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlFreeRMutex(xmlRMutexPtr tok)
Definition: threads.c:319
static int initialized
Definition: xslt.c:193

Referenced by xsltCleanupGlobals().

Variable Documentation

◆ initialized

int initialized = 0
static

Definition at line 193 of file xslt.c.

Referenced by xsltInit(), and xsltUninit().

◆ xsltEngineVersion

Definition at line 23 of file xslt.c.

◆ xsltLibxmlVersion

const int xsltLibxmlVersion = LIBXML_VERSION

Definition at line 25 of file xslt.c.

◆ xsltLibxsltVersion

const int xsltLibxsltVersion = LIBXSLT_VERSION

Definition at line 24 of file xslt.c.