ReactOS  0.4.15-dev-483-ga77a65a
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)
 
static xsltStylesheetPtr xsltNewStylesheetInternal (xsltStylesheetPtr parent)
 
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)
 
int xsltParseStylesheetUser (xsltStylesheetPtr style, xmlDocPtr doc)
 
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 6769 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 6774 of file xslt.c.

◆ NXT

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

Definition at line 6771 of file xslt.c.

◆ SKIP

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

Definition at line 6770 of file xslt.c.

◆ SKIP_BLANKS

#define SKIP_BLANKS   while (IS_BLANK(CUR)) NEXT

Definition at line 6772 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 809 of file xslt.c.

810 {
811  return(style->extrasNr++);
812 }
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 825 of file xslt.c.

826 {
827  if (ctxt->extrasNr >= ctxt->extrasMax) {
828  int i;
829  if (ctxt->extrasNr == 0) {
830  ctxt->extrasMax = 20;
831  ctxt->extras = (xsltRuntimeExtraPtr)
832  xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra));
833  if (ctxt->extras == NULL) {
835  "xsltAllocateExtraCtxt: out of memory\n");
836  return(0);
837  }
838  for (i = 0;i < ctxt->extrasMax;i++) {
839  ctxt->extras[i].info = NULL;
840  ctxt->extras[i].deallocate = NULL;
841  ctxt->extras[i].val.ptr = NULL;
842  }
843 
844  } else {
846 
847  ctxt->extrasMax += 100;
848  tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras,
849  ctxt->extrasMax * sizeof(xsltRuntimeExtra));
850  if (tmp == NULL) {
852  "xsltAllocateExtraCtxt: out of memory\n");
853  return(0);
854  }
855  ctxt->extras = tmp;
856  for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) {
857  ctxt->extras[i].info = NULL;
858  ctxt->extras[i].deallocate = NULL;
859  ctxt->extras[i].val.ptr = NULL;
860  }
861  }
862  }
863  return(ctxt->extrasNr++);
864 }
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
union _xsltRuntimeExtra::@3386 val
XMLPUBVAR xmlReallocFunc xmlRealloc
Definition: globals.h:249
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 895 of file xslt.c.

897 {
898 #if 0 /* TODO: Currently disabled, since probably not needed. */
899  xmlNodePtr cur;
900 
901  if ((doc == NULL) || (rootElem == NULL) ||
902  (rootElem->type != XML_ELEMENT_NODE) ||
903  (doc != rootElem->doc))
904  return(-1);
905 
906  /*
907  * Cleanup was suggested by Aleksey Sanin:
908  * Clear the PSVI field to avoid problems if the
909  * node-tree of the stylesheet is intended to be used for
910  * further processing by the user (e.g. for compiling it
911  * once again - although not recommended).
912  */
913 
914  cur = rootElem;
915  while (cur != NULL) {
916  if (cur->type == XML_ELEMENT_NODE) {
917  /*
918  * Clear the PSVI field.
919  */
920  cur->psvi = NULL;
921  if (cur->children) {
922  cur = cur->children;
923  continue;
924  }
925  }
926 
927 leave_node:
928  if (cur == rootElem)
929  break;
930  if (cur->next != NULL)
931  cur = cur->next;
932  else {
933  cur = cur->parent;
934  if (cur == NULL)
935  break;
936  goto leave_node;
937  }
938  }
939 #endif /* #if 0 */
940  return(0);
941 }
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 xsltParseStylesheetUser().

◆ 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:251
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
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:42

◆ 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:251
smooth NULL
Definition: ftsmooth.c:416
Definition: name.c:38
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:42

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 950 of file xslt.c.

951 {
952  if (style == NULL)
953  return;
954 
955 #ifdef XSLT_REFACTORED
956  /*
957  * Start with a cleanup of the main stylesheet's doc.
958  */
959  if ((style->principal == style) && (style->doc))
962 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
963  /*
964  * Restore changed ns-decls before freeing the document.
965  */
966  if ((style->doc != NULL) &&
967  XSLT_HAS_INTERNAL_NSMAP(style))
968  {
969  xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style),
970  style->doc);
971  }
972 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
973 #else
974  /*
975  * Start with a cleanup of the main stylesheet's doc.
976  */
977  if ((style->parent == NULL) && (style->doc))
980 #endif /* XSLT_REFACTORED */
981 
986  xsltFreeTemplateList(style->templates);
990  /*
991  * Free documents of all included stylsheet modules of this
992  * stylesheet level.
993  */
995  /*
996  * TODO: Best time to shutdown extension stuff?
997  */
999 
1000  if (style->variables != NULL)
1001  xsltFreeStackElemList(style->variables);
1002  if (style->cdataSection != NULL)
1003  xmlHashFree(style->cdataSection, NULL);
1004  if (style->stripSpaces != NULL)
1005  xmlHashFree(style->stripSpaces, NULL);
1006  if (style->nsHash != NULL)
1007  xmlHashFree(style->nsHash, NULL);
1008  if (style->exclPrefixTab != NULL)
1009  xmlFree(style->exclPrefixTab);
1010  if (style->method != NULL)
1011  xmlFree(style->method);
1012  if (style->methodURI != NULL)
1013  xmlFree(style->methodURI);
1014  if (style->version != NULL)
1015  xmlFree(style->version);
1016  if (style->encoding != NULL)
1017  xmlFree(style->encoding);
1018  if (style->doctypePublic != NULL)
1019  xmlFree(style->doctypePublic);
1020  if (style->doctypeSystem != NULL)
1021  xmlFree(style->doctypeSystem);
1022  if (style->mediaType != NULL)
1023  xmlFree(style->mediaType);
1024  if (style->attVTs)
1025  xsltFreeAVTList(style->attVTs);
1026  if (style->imports != NULL)
1027  xsltFreeStylesheetList(style->imports);
1028 
1029 #ifdef XSLT_REFACTORED
1030  /*
1031  * If this is the principal stylesheet, then
1032  * free its internal data.
1033  */
1034  if (style->principal == style) {
1035  if (style->principalData) {
1036  xsltFreePrincipalStylesheetData(style->principalData);
1037  style->principalData = NULL;
1038  }
1039  }
1040 #endif
1041  /*
1042  * Better to free the main document of this stylesheet level
1043  * at the end - so here.
1044  */
1045  if (style->doc != NULL) {
1046  xmlFreeDoc(style->doc);
1047  }
1048 
1049 #ifdef WITH_XSLT_DEBUG
1051  "freeing dictionary from stylesheet\n");
1052 #endif
1053  xmlDictFree(style->dict);
1054 
1055  if (style->xpathCtxt != NULL)
1056  xmlXPathFreeContext(style->xpathCtxt);
1057 
1058  memset(style, -1, sizeof(xsltStylesheet));
1059  xmlFree(style);
1060 }
void xsltFreeExts(xsltStylesheetPtr style)
Definition: extensions.c:479
void xsltFreeTemplateHashes(xsltStylesheetPtr style)
Definition: pattern.c:2600
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:327
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:895
void xsltFreeAttributeSetsHashes(xsltStylesheetPtr style)
Definition: attributes.c:1205
static void xsltFreeStylesheetList(xsltStylesheetPtr style)
Definition: xslt.c:873
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:800
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:608
void xsltShutdownExts(xsltStylesheetPtr style)
Definition: extensions.c:1133
void xsltFreeAVTList(void *avt)
Definition: attrvt.c:119
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(), xsltNewStylesheetInternal(), 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 873 of file xslt.c.

873  {
875 
876  while (style != NULL) {
877  next = style->next;
879  style = next;
880  }
881 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:950
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 3678 of file xslt.c.

3678  {
3679  xmlNodePtr cur;
3680  const xmlChar *URI;
3681 
3682  if (style == NULL)
3683  return;
3684  /*
3685  * TODO: basically if the stylesheet uses the same prefix for different
3686  * patterns, well they may be in problem, hopefully they will get
3687  * a warning first.
3688  */
3689  /*
3690  * TODO: Eliminate the use of the hash for XPath expressions.
3691  * An expression should be evaluated in the context of the in-scope
3692  * namespaces; eliminate the restriction of an XML document to contain
3693  * no duplicate prefixes for different namespace names.
3694  *
3695  */
3696  cur = xmlDocGetRootElement(style->doc);
3697  while (cur != NULL) {
3698  if (cur->type == XML_ELEMENT_NODE) {
3699  xmlNsPtr ns = cur->nsDef;
3700  while (ns != NULL) {
3701  if (ns->prefix != NULL) {
3702  if (style->nsHash == NULL) {
3703  style->nsHash = xmlHashCreate(10);
3704  if (style->nsHash == NULL) {
3706  "xsltGatherNamespaces: failed to create hash table\n");
3707  style->errors++;
3708  return;
3709  }
3710  }
3711  URI = xmlHashLookup(style->nsHash, ns->prefix);
3712  if ((URI != NULL) && (!xmlStrEqual(URI, ns->href))) {
3714  "Namespaces prefix %s used for multiple namespaces\n",ns->prefix);
3715  style->warnings++;
3716  } else if (URI == NULL) {
3717  xmlHashUpdateEntry(style->nsHash, ns->prefix,
3718  (void *) ns->href, NULL);
3719 
3720 #ifdef WITH_XSLT_DEBUG_PARSING
3722  "Added namespace: %s mapped to %s\n", ns->prefix, ns->href);
3723 #endif
3724  }
3725  }
3726  ns = ns->next;
3727  }
3728  }
3729 
3730  /*
3731  * Skip to next node
3732  */
3733  if (cur->children != NULL) {
3734  if (cur->children->type != XML_ENTITY_DECL) {
3735  cur = cur->children;
3736  continue;
3737  }
3738  }
3739  if (cur->next != NULL) {
3740  cur = cur->next;
3741  continue;
3742  }
3743 
3744  do {
3745  cur = cur->parent;
3746  if (cur == NULL)
3747  break;
3748  if (cur == (xmlNodePtr) style->doc) {
3749  cur = NULL;
3750  break;
3751  }
3752  if (cur->next != NULL) {
3753  cur = cur->next;
3754  break;
3755  }
3756  } while (cur != NULL);
3757  }
3758 }
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:181
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:430
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:466
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 xsltParseStylesheetUser().

◆ 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 1086 of file xslt.c.

1089 {
1090  xmlNsPtr cur;
1091  xmlNsPtr *ret = NULL;
1092  int nbns = 0;
1093  int maxns = 10;
1094  int i;
1095 
1096  if ((style == NULL) || (template == NULL) || (node == NULL) ||
1097  (template->inheritedNsNr != 0) || (template->inheritedNs != NULL))
1098  return(0);
1099  while (node != NULL) {
1100  if (node->type == XML_ELEMENT_NODE) {
1101  cur = node->nsDef;
1102  while (cur != NULL) {
1103  if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
1104  goto skip_ns;
1105 
1106  if ((cur->prefix != NULL) &&
1107  (xsltCheckExtPrefix(style, cur->prefix)))
1108  goto skip_ns;
1109  /*
1110  * Check if this namespace was excluded.
1111  * Note that at this point only the exclusions defined
1112  * on the topmost stylesheet element are in the exclusion-list.
1113  */
1114  for (i = 0;i < style->exclPrefixNr;i++) {
1115  if (xmlStrEqual(cur->href, style->exclPrefixTab[i]))
1116  goto skip_ns;
1117  }
1118  if (ret == NULL) {
1119  ret =
1120  (xmlNsPtr *) xmlMalloc((maxns + 1) *
1121  sizeof(xmlNsPtr));
1122  if (ret == NULL) {
1124  "xsltGetInheritedNsList : out of memory!\n");
1125  return(0);
1126  }
1127  ret[nbns] = NULL;
1128  }
1129  /*
1130  * Skip shadowed namespace bindings.
1131  */
1132  for (i = 0; i < nbns; i++) {
1133  if ((cur->prefix == ret[i]->prefix) ||
1134  (xmlStrEqual(cur->prefix, ret[i]->prefix)))
1135  break;
1136  }
1137  if (i >= nbns) {
1138  if (nbns >= maxns) {
1139  maxns *= 2;
1140  ret = (xmlNsPtr *) xmlRealloc(ret,
1141  (maxns +
1142  1) *
1143  sizeof(xmlNsPtr));
1144  if (ret == NULL) {
1146  "xsltGetInheritedNsList : realloc failed!\n");
1147  return(0);
1148  }
1149  }
1150  ret[nbns++] = cur;
1151  ret[nbns] = NULL;
1152  }
1153 skip_ns:
1154  cur = cur->next;
1155  }
1156  }
1157  node = node->parent;
1158  }
1159  if (nbns != 0) {
1160 #ifdef WITH_XSLT_DEBUG_PARSING
1162  "template has %d inherited namespaces\n", nbns);
1163 #endif
1164  template->inheritedNsNr = nbns;
1165  template->inheritedNs = ret;
1166  }
1167  return (nbns);
1168 }
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 xsltNewStylesheetInternal().

◆ 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 6877 of file xslt.c.

6877  {
6878  xmlNodePtr child;
6880  xmlChar *href = NULL;
6881  xmlURIPtr URI;
6882 
6883  xsltInitGlobals();
6884 
6885  if (doc == NULL)
6886  return(NULL);
6887 
6888  /*
6889  * Find the text/xml stylesheet PI id any before the root
6890  */
6891  child = doc->children;
6892  while ((child != NULL) && (child->type != XML_ELEMENT_NODE)) {
6893  if ((child->type == XML_PI_NODE) &&
6894  (xmlStrEqual(child->name, BAD_CAST "xml-stylesheet"))) {
6895  href = xsltParseStylesheetPI(child->content);
6896  if (href != NULL)
6897  break;
6898  }
6899  child = child->next;
6900  }
6901 
6902  /*
6903  * If found check the href to select processing
6904  */
6905  if (href != NULL) {
6906 #ifdef WITH_XSLT_DEBUG_PARSING
6908  "xsltLoadStylesheetPI : found PI href=%s\n", href);
6909 #endif
6910  URI = xmlParseURI((const char *) href);
6911  if (URI == NULL) {
6913  "xml-stylesheet : href %s is not valid\n", href);
6914  xmlFree(href);
6915  return(NULL);
6916  }
6917  if ((URI->fragment != NULL) && (URI->scheme == NULL) &&
6918  (URI->opaque == NULL) && (URI->authority == NULL) &&
6919  (URI->server == NULL) && (URI->user == NULL) &&
6920  (URI->path == NULL) && (URI->query == NULL)) {
6921  xmlAttrPtr ID;
6922 
6923 #ifdef WITH_XSLT_DEBUG_PARSING
6925  "xsltLoadStylesheetPI : Reference to ID %s\n", href);
6926 #endif
6927  if (URI->fragment[0] == '#')
6928  ID = xmlGetID(doc, (const xmlChar *) &(URI->fragment[1]));
6929  else
6930  ID = xmlGetID(doc, (const xmlChar *) URI->fragment);
6931  if (ID == NULL) {
6933  "xml-stylesheet : no ID %s found\n", URI->fragment);
6934  } else {
6935  xmlDocPtr fake;
6936  xmlNodePtr subtree, newtree;
6937  xmlNsPtr ns;
6938 
6939 #ifdef WITH_XSLT_DEBUG
6941  "creating new document from %s for embedded stylesheet\n",
6942  doc->URL);
6943 #endif
6944  /*
6945  * move the subtree in a new document passed to
6946  * the stylesheet analyzer
6947  */
6948  subtree = ID->parent;
6949  fake = xmlNewDoc(NULL);
6950  if (fake != NULL) {
6951  /*
6952  * Should the dictionary still be shared even though
6953  * the nodes are being copied rather than moved?
6954  */
6955  fake->dict = doc->dict;
6956  xmlDictReference(doc->dict);
6957 #ifdef WITH_XSLT_DEBUG
6959  "reusing dictionary from %s for embedded stylesheet\n",
6960  doc->URL);
6961 #endif
6962 
6963  newtree = xmlDocCopyNode(subtree, fake, 1);
6964 
6965  fake->URL = xmlNodeGetBase(doc, subtree->parent);
6966 #ifdef WITH_XSLT_DEBUG
6968  "set base URI for embedded stylesheet as %s\n",
6969  fake->URL);
6970 #endif
6971 
6972  /*
6973  * Add all namespaces in scope of embedded stylesheet to
6974  * root element of newly created stylesheet document
6975  */
6976  while ((subtree = subtree->parent) != (xmlNodePtr)doc) {
6977  for (ns = subtree->ns; ns; ns = ns->next) {
6978  xmlNewNs(newtree, ns->href, ns->prefix);
6979  }
6980  }
6981 
6982  xmlAddChild((xmlNodePtr)fake, newtree);
6983  ret = xsltParseStylesheetDoc(fake);
6984  if (ret == NULL)
6985  xmlFreeDoc(fake);
6986  }
6987  }
6988  } else {
6989  xmlChar *URL, *base;
6990 
6991  /*
6992  * Reference to an external stylesheet
6993  */
6994 
6995  base = xmlNodeGetBase(doc, (xmlNodePtr) doc);
6996  URL = xmlBuildURI(href, base);
6997  if (URL != NULL) {
6998 #ifdef WITH_XSLT_DEBUG_PARSING
7000  "xsltLoadStylesheetPI : fetching %s\n", URL);
7001 #endif
7003  xmlFree(URL);
7004  } else {
7005 #ifdef WITH_XSLT_DEBUG_PARSING
7007  "xsltLoadStylesheetPI : fetching %s\n", href);
7008 #endif
7009  ret = xsltParseStylesheetFile(href);
7010  }
7011  if (base != NULL)
7012  xmlFree(base);
7013  }
7014  xmlFreeURI(URI);
7015  xmlFree(href);
7016  }
7017  return(ret);
7018 }
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:645
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:934
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:2846
char * server
Definition: uri.h:37
static xmlChar * xsltParseStylesheetPI(const xmlChar *value)
Definition: xslt.c:6787
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:1884
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:6715
#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:6699
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:1381
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 xsltNewStylesheetInternal(), 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 795 of file xslt.c.

795  {
797 }
static xsltStylesheetPtr xsltNewStylesheetInternal(xsltStylesheetPtr parent)
Definition: xslt.c:730
smooth NULL
Definition: ftsmooth.c:416

Referenced by xsltDocumentElem().

◆ xsltNewStylesheetInternal()

static xsltStylesheetPtr xsltNewStylesheetInternal ( xsltStylesheetPtr  parent)
static

xsltNewStylesheetInternal: @parent: the parent stylesheet or NULL

Create a new XSLT Stylesheet

Returns the newly allocated xsltStylesheetPtr or NULL in case of error

Definition at line 730 of file xslt.c.

730  {
732 
734  if (ret == NULL) {
736  "xsltNewStylesheet : malloc failed\n");
737  goto internal_err;
738  }
739  memset(ret, 0, sizeof(xsltStylesheet));
740 
741  ret->parent = parent;
742  ret->omitXmlDeclaration = -1;
743  ret->standalone = -1;
744  ret->decimalFormat = xsltNewDecimalFormat(NULL, NULL);
745  ret->indent = -1;
746  ret->errors = 0;
747  ret->warnings = 0;
748  ret->exclPrefixNr = 0;
749  ret->exclPrefixMax = 0;
750  ret->exclPrefixTab = NULL;
751  ret->extInfos = NULL;
752  ret->extrasNr = 0;
753  ret->internalized = 1;
754  ret->literal_result = 0;
755  ret->forwards_compatible = 0;
756  ret->dict = xmlDictCreate();
757 #ifdef WITH_XSLT_DEBUG
759  "creating dictionary for stylesheet\n");
760 #endif
761 
762  if (parent == NULL) {
763  ret->principal = ret;
764 
765  ret->xpathCtxt = xmlXPathNewContext(NULL);
766  if (ret->xpathCtxt == NULL) {
768  "xsltNewStylesheet: xmlXPathNewContext failed\n");
769  goto internal_err;
770  }
771  if (xmlXPathContextSetCache(ret->xpathCtxt, 1, -1, 0) == -1)
772  goto internal_err;
773  } else {
774  ret->principal = parent->principal;
775  }
776 
777  xsltInit();
778 
779  return(ret);
780 
781 internal_err:
782  if (ret != NULL)
784  return(NULL);
785 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:950
XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate(void)
Definition: dict.c:575
static xsltDecimalFormatPtr xsltNewDecimalFormat(const xmlChar *nsUri, xmlChar *name)
Definition: xslt.c:250
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
r parent
Definition: btrfs.c:2944
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 xsltNewStylesheet(), 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 1399 of file xslt.c.

1400 {
1401  xmlChar *prop;
1403  xsltDecimalFormatPtr iter;
1404 
1405  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1406  return;
1407 
1408  format = style->decimalFormat;
1409 
1410  prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL);
1411  if (prop != NULL) {
1412  const xmlChar *nsUri;
1413 
1414  if (xmlValidateQName(prop, 0) != 0) {
1416  "xsl:decimal-format: Invalid QName '%s'.\n", prop);
1417  style->warnings++;
1418  xmlFree(prop);
1419  return;
1420  }
1421  /*
1422  * TODO: Don't use xsltGetQNameURI().
1423  */
1424  nsUri = xsltGetQNameURI(cur, &prop);
1425  if (prop == NULL) {
1426  style->warnings++;
1427  return;
1428  }
1429  format = xsltDecimalFormatGetByQName(style, nsUri, prop);
1430  if (format != NULL) {
1432  "xsltParseStylestyleDecimalFormat: %s already exists\n", prop);
1433  style->warnings++;
1434  xmlFree(prop);
1435  return;
1436  }
1437  format = xsltNewDecimalFormat(nsUri, prop);
1438  if (format == NULL) {
1440  "xsltParseStylestyleDecimalFormat: failed creating new decimal-format\n");
1441  style->errors++;
1442  xmlFree(prop);
1443  return;
1444  }
1445  /* Append new decimal-format structure */
1446  for (iter = style->decimalFormat; iter->next; iter = iter->next)
1447  ;
1448  if (iter)
1449  iter->next = format;
1450  }
1451 
1452  prop = xmlGetNsProp(cur, (const xmlChar *)"decimal-separator", NULL);
1453  if (prop != NULL) {
1454  if (format->decimalPoint != NULL) xmlFree(format->decimalPoint);
1455  format->decimalPoint = prop;
1456  }
1457 
1458  prop = xmlGetNsProp(cur, (const xmlChar *)"grouping-separator", NULL);
1459  if (prop != NULL) {
1460  if (format->grouping != NULL) xmlFree(format->grouping);
1461  format->grouping = prop;
1462  }
1463 
1464  prop = xmlGetNsProp(cur, (const xmlChar *)"infinity", NULL);
1465  if (prop != NULL) {
1466  if (format->infinity != NULL) xmlFree(format->infinity);
1467  format->infinity = prop;
1468  }
1469 
1470  prop = xmlGetNsProp(cur, (const xmlChar *)"minus-sign", NULL);
1471  if (prop != NULL) {
1472  if (format->minusSign != NULL) xmlFree(format->minusSign);
1473  format->minusSign = prop;
1474  }
1475 
1476  prop = xmlGetNsProp(cur, (const xmlChar *)"NaN", NULL);
1477  if (prop != NULL) {
1478  if (format->noNumber != NULL) xmlFree(format->noNumber);
1479  format->noNumber = prop;
1480  }
1481 
1482  prop = xmlGetNsProp(cur, (const xmlChar *)"percent", NULL);
1483  if (prop != NULL) {
1484  if (format->percent != NULL) xmlFree(format->percent);
1485  format->percent = prop;
1486  }
1487 
1488  prop = xmlGetNsProp(cur, (const xmlChar *)"per-mille", NULL);
1489  if (prop != NULL) {
1490  if (format->permille != NULL) xmlFree(format->permille);
1491  format->permille = prop;
1492  }
1493 
1494  prop = xmlGetNsProp(cur, (const xmlChar *)"zero-digit", NULL);
1495  if (prop != NULL) {
1496  if (format->zeroDigit != NULL) xmlFree(format->zeroDigit);
1497  format->zeroDigit = prop;
1498  }
1499 
1500  prop = xmlGetNsProp(cur, (const xmlChar *)"digit", NULL);
1501  if (prop != NULL) {
1502  if (format->digit != NULL) xmlFree(format->digit);
1503  format->digit = prop;
1504  }
1505 
1506  prop = xmlGetNsProp(cur, (const xmlChar *)"pattern-separator", NULL);
1507  if (prop != NULL) {
1508  if (format->patternSeparator != NULL) xmlFree(format->patternSeparator);
1509  format->patternSeparator = prop;
1510  }
1511  if (cur->children != NULL) {
1513  }
1514 }
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 6699 of file xslt.c.

6699  {
6700  xsltInitGlobals();
6701 
6702  return(xsltParseStylesheetImportedDoc(doc, NULL));
6703 }
xsltStylesheetPtr xsltParseStylesheetImportedDoc(xmlDocPtr doc, xsltStylesheetPtr parentStyle)
Definition: xslt.c:6518
smooth NULL
Definition: ftsmooth.c:416
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 1735 of file xslt.c.

1737 {
1738  int nb = 0;
1739  xmlChar *prefixes;
1740  xmlChar *prefix, *end;
1741 
1742  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1743  return(0);
1744 
1745  if (isXsltElem)
1746  prefixes = xmlGetNsProp(cur,
1747  (const xmlChar *)"exclude-result-prefixes", NULL);
1748  else
1749  prefixes = xmlGetNsProp(cur,
1750  (const xmlChar *)"exclude-result-prefixes", XSLT_NAMESPACE);
1751 
1752  if (prefixes == NULL) {
1753  return(0);
1754  }
1755 
1756  prefix = prefixes;
1757  while (*prefix != 0) {
1758  while (IS_BLANK(*prefix)) prefix++;
1759  if (*prefix == 0)
1760  break;
1761  end = prefix;
1762  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1763  prefix = xmlStrndup(prefix, end - prefix);
1764  if (prefix) {
1765  xmlNsPtr ns;
1766 
1767  if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
1768  ns = xmlSearchNs(style->doc, cur, NULL);
1769  else
1770  ns = xmlSearchNs(style->doc, cur, prefix);
1771  if (ns == NULL) {
1773  "xsl:exclude-result-prefixes : undefined namespace %s\n",
1774  prefix);
1775  if (style != NULL) style->warnings++;
1776  } else {
1777  if (exclPrefixPush(style, (xmlChar *) ns->href) >= 0) {
1778 #ifdef WITH_XSLT_DEBUG_PARSING
1780  "exclude result prefix %s\n", prefix);
1781 #endif
1782  nb++;
1783  }
1784  }
1785  xmlFree(prefix);
1786  }
1787  prefix = end;
1788  }
1789  xmlFree(prefixes);
1790  return(nb);
1791 }
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 1599 of file xslt.c.

1600  {
1601  xmlChar *prefixes;
1602  xmlChar *prefix, *end;
1603 
1604  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1605  return;
1606 
1607  if (isXsltElem) {
1608  /* For xsl:stylesheet/xsl:transform. */
1609  prefixes = xmlGetNsProp(cur,
1610  (const xmlChar *)"extension-element-prefixes", NULL);
1611  } else {
1612  /* For literal result elements and extension instructions. */
1613  prefixes = xmlGetNsProp(cur,
1614  (const xmlChar *)"extension-element-prefixes", XSLT_NAMESPACE);
1615  }
1616  if (prefixes == NULL) {
1617  return;
1618  }
1619 
1620  prefix = prefixes;
1621  while (*prefix != 0) {
1622  while (IS_BLANK(*prefix)) prefix++;
1623  if (*prefix == 0)
1624  break;
1625  end = prefix;
1626  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1627  prefix = xmlStrndup(prefix, end - prefix);
1628  if (prefix) {
1629  xmlNsPtr ns;
1630 
1631  if (xmlStrEqual(prefix, (const xmlChar *)"#default"))
1632  ns = xmlSearchNs(style->doc, cur, NULL);
1633  else
1634  ns = xmlSearchNs(style->doc, cur, prefix);
1635  if (ns == NULL) {
1637  "xsl:extension-element-prefix : undefined namespace %s\n",
1638  prefix);
1639  if (style != NULL) style->warnings++;
1640  } else {
1641 #ifdef WITH_XSLT_DEBUG_PARSING
1643  "add extension prefix %s\n", prefix);
1644 #endif
1645  xsltRegisterExtPrefix(style, prefix, ns->href);
1646  }
1647  xmlFree(prefix);
1648  }
1649  prefix = end;
1650  }
1651  xmlFree(prefixes);
1652 }
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 6715 of file xslt.c.

6715  {
6718  xmlDocPtr doc;
6719 
6720  xsltInitGlobals();
6721 
6722  if (filename == NULL)
6723  return(NULL);
6724 
6725 #ifdef WITH_XSLT_DEBUG_PARSING
6727  "xsltParseStylesheetFile : parse %s\n", filename);
6728 #endif
6729 
6730  /*
6731  * Security framework check
6732  */
6734  if (sec != NULL) {
6735  int res;
6736 
6737  res = xsltCheckRead(sec, NULL, filename);
6738  if (res <= 0) {
6739  if (res == 0)
6741  "xsltParseStylesheetFile: read rights for %s denied\n",
6742  filename);
6743  return(NULL);
6744  }
6745  }
6746 
6749  if (doc == NULL) {
6751  "xsltParseStylesheetFile : cannot parse %s\n", filename);
6752  return(NULL);
6753  }
6754  ret = xsltParseStylesheetDoc(doc);
6755  if (ret == NULL) {
6756  xmlFreeDoc(doc);
6757  return(NULL);
6758  }
6759 
6760  return(ret);
6761 }
xsltDocLoaderFunc xsltDocDefaultLoader
Definition: documents.c:93
int xsltCheckRead(xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL)
Definition: security.c:402
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:6699
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 6518 of file xslt.c.

6519  {
6520  xsltStylesheetPtr retStyle;
6521 
6522  if (doc == NULL)
6523  return(NULL);
6524 
6525  retStyle = xsltNewStylesheetInternal(parentStyle);
6526  if (retStyle == NULL)
6527  return(NULL);
6528 
6529  if (xsltParseStylesheetUser(retStyle, doc) != 0) {
6530  xsltFreeStylesheet(retStyle);
6531  return(NULL);
6532  }
6533 
6534  return(retStyle);
6535 }
void xsltFreeStylesheet(xsltStylesheetPtr style)
Definition: xslt.c:950
static xsltStylesheetPtr xsltNewStylesheetInternal(xsltStylesheetPtr parent)
Definition: xslt.c:730
int xsltParseStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc)
Definition: xslt.c:6547
smooth NULL
Definition: ftsmooth.c:416

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 5102 of file xslt.c.

5102  {
5103  xmlChar *prop = NULL;
5104  xmlChar *use = NULL;
5105  xmlChar *match = NULL;
5106  xmlChar *name = NULL;
5107  xmlChar *nameURI = NULL;
5108 
5109  if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE))
5110  return;
5111 
5112  /*
5113  * Get arguments
5114  */
5115  prop = xmlGetNsProp(key, (const xmlChar *)"name", NULL);
5116  if (prop != NULL) {
5117  const xmlChar *URI;
5118 
5119  /*
5120  * TODO: Don't use xsltGetQNameURI().
5121  */
5122  URI = xsltGetQNameURI(key, &prop);
5123  if (prop == NULL) {
5124  if (style != NULL) style->errors++;
5125  goto error;
5126  } else {
5127  name = prop;
5128  if (URI != NULL)
5129  nameURI = xmlStrdup(URI);
5130  }
5131 #ifdef WITH_XSLT_DEBUG_PARSING
5133  "xsltParseStylesheetKey: name %s\n", name);
5134 #endif
5135  } else {
5137  "xsl:key : error missing name\n");
5138  if (style != NULL) style->errors++;
5139  goto error;
5140  }
5141 
5142  match = xmlGetNsProp(key, (const xmlChar *)"match", NULL);
5143  if (match == NULL) {
5145  "xsl:key : error missing match\n");
5146  if (style != NULL) style->errors++;
5147  goto error;
5148  }
5149 
5150  use = xmlGetNsProp(key, (const xmlChar *)"use", NULL);
5151  if (use == NULL) {
5153  "xsl:key : error missing use\n");
5154  if (style != NULL) style->errors++;
5155  goto error;
5156  }
5157 
5158  /*
5159  * register the keys
5160  */
5161  xsltAddKey(style, name, nameURI, match, use, key);
5162 
5163 
5164 error:
5165  if (use != NULL)
5166  xmlFree(use);
5167  if (match != NULL)
5168  xmlFree(match);
5169  if (name != NULL)
5170  xmlFree(name);
5171  if (nameURI != NULL)
5172  xmlFree(nameURI);
5173 
5174  if (key->children != NULL) {
5175  xsltParseContentError(style, key->children);
5176  }
5177 }
int xsltAddKey(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *nameURI, const xmlChar *match, const xmlChar *use, xmlNodePtr inst)
Definition: keys.c:263
#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:38
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:41
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 1181 of file xslt.c.

1182 {
1183  xmlChar *elements,
1184  *prop;
1185  xmlChar *element,
1186  *end;
1187 
1188  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1189  return;
1190 
1191  prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL);
1192  if (prop != NULL) {
1193  if (style->version != NULL)
1194  xmlFree(style->version);
1195  style->version = prop;
1196  }
1197 
1198  prop = xmlGetNsProp(cur, (const xmlChar *) "encoding", NULL);
1199  if (prop != NULL) {
1200  if (style->encoding != NULL)
1201  xmlFree(style->encoding);
1202  style->encoding = prop;
1203  }
1204 
1205  /* relaxed to support xt:document
1206  * TODO KB: What does "relaxed to support xt:document" mean?
1207  */
1208  prop = xmlGetNsProp(cur, (const xmlChar *) "method", NULL);
1209  if (prop != NULL) {
1210  const xmlChar *URI;
1211 
1212  if (style->method != NULL)
1213  xmlFree(style->method);
1214  style->method = NULL;
1215  if (style->methodURI != NULL)
1216  xmlFree(style->methodURI);
1217  style->methodURI = NULL;
1218 
1219  /*
1220  * TODO: Don't use xsltGetQNameURI().
1221  */
1222  URI = xsltGetQNameURI(cur, &prop);
1223  if (prop == NULL) {
1224  if (style != NULL) style->errors++;
1225  } else if (URI == NULL) {
1226  if ((xmlStrEqual(prop, (const xmlChar *) "xml")) ||
1227  (xmlStrEqual(prop, (const xmlChar *) "html")) ||
1228  (xmlStrEqual(prop, (const xmlChar *) "text"))) {
1229  style->method = prop;
1230  } else {
1232  "invalid value for method: %s\n", prop);
1233  if (style != NULL) style->warnings++;
1234  xmlFree(prop);
1235  }
1236  } else {
1237  style->method = prop;
1238  style->methodURI = xmlStrdup(URI);
1239  }
1240  }
1241 
1242  prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-system", NULL);
1243  if (prop != NULL) {
1244  if (style->doctypeSystem != NULL)
1245  xmlFree(style->doctypeSystem);
1246  style->doctypeSystem = prop;
1247  }
1248 
1249  prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-public", NULL);
1250  if (prop != NULL) {
1251  if (style->doctypePublic != NULL)
1252  xmlFree(style->doctypePublic);
1253  style->doctypePublic = prop;
1254  }
1255 
1256  prop = xmlGetNsProp(cur, (const xmlChar *) "standalone", NULL);
1257  if (prop != NULL) {
1258  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1259  style->standalone = 1;
1260  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1261  style->standalone = 0;
1262  } else {
1264  "invalid value for standalone: %s\n", prop);
1265  style->errors++;
1266  }
1267  xmlFree(prop);
1268  }
1269 
1270  prop = xmlGetNsProp(cur, (const xmlChar *) "indent", NULL);
1271  if (prop != NULL) {
1272  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1273  style->indent = 1;
1274  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1275  style->indent = 0;
1276  } else {
1278  "invalid value for indent: %s\n", prop);
1279  style->errors++;
1280  }
1281  xmlFree(prop);
1282  }
1283 
1284  prop = xmlGetNsProp(cur, (const xmlChar *) "omit-xml-declaration", NULL);
1285  if (prop != NULL) {
1286  if (xmlStrEqual(prop, (const xmlChar *) "yes")) {
1287  style->omitXmlDeclaration = 1;
1288  } else if (xmlStrEqual(prop, (const xmlChar *) "no")) {
1289  style->omitXmlDeclaration = 0;
1290  } else {
1292  "invalid value for omit-xml-declaration: %s\n",
1293  prop);
1294  style->errors++;
1295  }
1296  xmlFree(prop);
1297  }
1298 
1299  elements = xmlGetNsProp(cur, (const xmlChar *) "cdata-section-elements",
1300  NULL);
1301  if (elements != NULL) {
1302  if (style->cdataSection == NULL)
1303  style->cdataSection = xmlHashCreate(10);
1304  if (style->cdataSection == NULL)
1305  return;
1306 
1307  element = elements;
1308  while (*element != 0) {
1309  while (IS_BLANK(*element))
1310  element++;
1311  if (*element == 0)
1312  break;
1313  end = element;
1314  while ((*end != 0) && (!IS_BLANK(*end)))
1315  end++;
1317  if (element) {
1318 #ifdef WITH_XSLT_DEBUG_PARSING
1320  "add cdata section output element %s\n",
1321  element);
1322 #endif
1323  if (xmlValidateQName(BAD_CAST element, 0) != 0) {
1325  "Attribute 'cdata-section-elements': The value "
1326  "'%s' is not a valid QName.\n", element);
1327  xmlFree(element);
1328  style->errors++;
1329  } else {
1330  const xmlChar *URI;
1331 
1332  /*
1333  * TODO: Don't use xsltGetQNameURI().
1334  */
1335  URI = xsltGetQNameURI(cur, &element);
1336  if (element == NULL) {
1337  /*
1338  * TODO: We'll report additionally an error
1339  * via the stylesheet's error handling.
1340  */
1342  "Attribute 'cdata-section-elements': "
1343  "Not a valid QName.\n");
1344  style->errors++;
1345  } else {
1346  xmlNsPtr ns;
1347 
1348  /*
1349  * XSLT-1.0 "Each QName is expanded into an
1350  * expanded-name using the namespace declarations in
1351  * effect on the xsl:output element in which the QName
1352  * occurs; if there is a default namespace, it is used
1353  * for QNames that do not have a prefix"
1354  * NOTE: Fix of bug #339570.
1355  */
1356  if (URI == NULL) {
1357  ns = xmlSearchNs(style->doc, cur, NULL);
1358  if (ns != NULL)
1359  URI = ns->href;
1360  }
1361  xmlHashAddEntry2(style->cdataSection, element, URI,
1362  (void *) "cdata");
1363  xmlFree(element);
1364  }
1365  }
1366  }
1367  element = end;
1368  }
1369  xmlFree(elements);
1370  }
1371 
1372  prop = xmlGetNsProp(cur, (const xmlChar *) "media-type", NULL);
1373  if (prop != NULL) {
1374  if (style->mediaType)
1375  xmlFree(style->mediaType);
1376  style->mediaType = prop;
1377  }
1378  if (cur->children != NULL) {
1380  }
1381 }
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:411
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:181
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 6787 of file xslt.c.

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

1526  {
1527  xmlChar *elements;
1528  xmlChar *element, *end;
1529 
1530  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1531  return;
1532 
1533  elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
1534  if (elements == NULL) {
1536  "xsltParseStylesheetPreserveSpace: missing elements attribute\n");
1537  if (style != NULL) style->warnings++;
1538  return;
1539  }
1540 
1541  if (style->stripSpaces == NULL)
1542  style->stripSpaces = xmlHashCreate(10);
1543  if (style->stripSpaces == NULL)
1544  return;
1545 
1546  element = elements;
1547  while (*element != 0) {
1548  while (IS_BLANK(*element)) element++;
1549  if (*element == 0)
1550  break;
1551  end = element;
1552  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1554  if (element) {
1555 #ifdef WITH_XSLT_DEBUG_PARSING
1557  "add preserved space element %s\n", element);
1558 #endif
1559  if (xmlStrEqual(element, (const xmlChar *)"*")) {
1560  style->stripAll = -1;
1561  } else {
1562  const xmlChar *URI;
1563 
1564  /*
1565  * TODO: Don't use xsltGetQNameURI().
1566  */
1567  URI = xsltGetQNameURI(cur, &element);
1568 
1569  xmlHashAddEntry2(style->stripSpaces, element, URI,
1570  (xmlChar *) "preserve");
1571  }
1572  xmlFree(element);
1573  }
1574  element = end;
1575  }
1576  xmlFree(elements);
1577  if (cur->children != NULL) {
1579  }
1580 }
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:411
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:181
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 6410 of file xslt.c.

6410  {
6411  xmlNodePtr cur;
6412 
6413  xsltInitGlobals();
6414 
6415  if (doc == NULL)
6416  return(NULL);
6417  if (ret == NULL)
6418  return(ret);
6419 
6420  /*
6421  * First steps, remove blank nodes,
6422  * locate the xsl:stylesheet element and the
6423  * namespace declaration.
6424  */
6425  cur = xmlDocGetRootElement(doc);
6426  if (cur == NULL) {
6428  "xsltParseStylesheetProcess : empty stylesheet\n");
6429  return(NULL);
6430  }
6431 
6432  if ((IS_XSLT_ELEM(cur)) &&
6433  ((IS_XSLT_NAME(cur, "stylesheet")) ||
6434  (IS_XSLT_NAME(cur, "transform")))) {
6435 #ifdef WITH_XSLT_DEBUG_PARSING
6437  "xsltParseStylesheetProcess : found stylesheet\n");
6438 #endif
6439  ret->literal_result = 0;
6442  } else {
6445  ret->literal_result = 1;
6446  }
6447  if (!ret->nopreproc) {
6449  }
6450  if (ret->literal_result == 0) {
6452  } else {
6453  xmlChar *prop;
6454  xsltTemplatePtr template;
6455 
6456  /*
6457  * the document itself might be the template, check xsl:version
6458  */
6459  prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
6460  if (prop == NULL) {
6461  xsltTransformError(NULL, ret, cur,
6462  "xsltParseStylesheetProcess : document is not a stylesheet\n");
6463  return(NULL);
6464  }
6465 
6466 #ifdef WITH_XSLT_DEBUG_PARSING
6468  "xsltParseStylesheetProcess : document is stylesheet\n");
6469 #endif
6470 
6471  if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
6472  (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
6473  xsltTransformError(NULL, ret, cur,
6474  "xsl:version: only 1.1 features are supported\n");
6475  ret->forwards_compatible = 1;
6476  ret->warnings++;
6477  }
6478  xmlFree(prop);
6479 
6480  /*
6481  * Create and link the template
6482  */
6483  template = xsltNewTemplate();
6484  if (template == NULL) {
6485  return(NULL);
6486  }
6487  template->next = ret->templates;
6488  ret->templates = template;
6489  template->match = xmlStrdup((const xmlChar *)"/");
6490 
6491  /*
6492  * parse the content and register the pattern
6493  */
6495  template->elem = (xmlNodePtr) doc;
6496  template->content = doc->children;
6497  xsltAddTemplate(ret, template, NULL, NULL);
6498  ret->literal_result = 1;
6499  }
6500 
6501  return(ret);
6502 }
int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:2104
#define XSLT_NAMESPACE
Definition: xslt.h:46
static void xsltPreprocessStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:3469
#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:1599
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:1735
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:4882
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:6082
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xsltParseStylesheetInclude(), and xsltParseStylesheetUser().

◆ 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 1665 of file xslt.c.

1665  {
1666  xmlChar *elements;
1667  xmlChar *element, *end;
1668 
1669  if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
1670  return;
1671 
1672  elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
1673  if (elements == NULL) {
1675  "xsltParseStylesheetStripSpace: missing elements attribute\n");
1676  if (style != NULL) style->warnings++;
1677  return;
1678  }
1679 
1680  if (style->stripSpaces == NULL)
1681  style->stripSpaces = xmlHashCreate(10);
1682  if (style->stripSpaces == NULL)
1683  return;
1684 
1685  element = elements;
1686  while (*element != 0) {
1687  while (IS_BLANK(*element)) element++;
1688  if (*element == 0)
1689  break;
1690  end = element;
1691  while ((*end != 0) && (!IS_BLANK(*end))) end++;
1693  if (element) {
1694 #ifdef WITH_XSLT_DEBUG_PARSING
1696  "add stripped space element %s\n", element);
1697 #endif
1698  if (xmlStrEqual(element, (const xmlChar *)"*")) {
1699  style->stripAll = 1;
1700  } else {
1701  const xmlChar *URI;
1702 
1703  /*
1704  * TODO: Don't use xsltGetQNameURI().
1705  */
1706  URI = xsltGetQNameURI(cur, &element);
1707 
1708  xmlHashAddEntry2(style->stripSpaces, element, URI,
1709  (xmlChar *) "strip");
1710  }
1711  xmlFree(element);
1712  }
1713  element = end;
1714  }
1715  xmlFree(elements);
1716  if (cur->children != NULL) {
1718  }
1719 }
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:411
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:181
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 5354 of file xslt.c.

5354  {
5356  xmlChar *prop;
5357  xmlChar *mode = NULL;
5358  xmlChar *modeURI = NULL;
5359  double priority;
5360 
5361  if ((style == NULL) || (template == NULL) ||
5362  (template->type != XML_ELEMENT_NODE))
5363  return;
5364 
5365  /*
5366  * Create and link the structure
5367  */
5368  ret = xsltNewTemplate();
5369  if (ret == NULL)
5370  return;
5371  ret->next = style->templates;
5372  style->templates = ret;
5373  ret->style = style;
5374 
5375  /*
5376  * Get inherited namespaces
5377  */
5378  /*
5379  * TODO: Apply the optimized in-scope-namespace mechanism
5380  * as for the other XSLT instructions.
5381  */
5382  xsltGetInheritedNsList(style, ret, template);
5383 
5384  /*
5385  * Get arguments
5386  */
5387  prop = xmlGetNsProp(template, (const xmlChar *)"mode", NULL);
5388  if (prop != NULL) {
5389  const xmlChar *URI;
5390 
5391  /*
5392  * TODO: Don't use xsltGetQNameURI().
5393  */
5394  URI = xsltGetQNameURI(template, &prop);
5395  if (prop == NULL) {
5396  if (style != NULL) style->errors++;
5397  goto error;
5398  } else {
5399  mode = prop;
5400  if (URI != NULL)
5401  modeURI = xmlStrdup(URI);
5402  }
5403  ret->mode = xmlDictLookup(style->dict, mode, -1);
5404  ret->modeURI = xmlDictLookup(style->dict, modeURI, -1);
5405 #ifdef WITH_XSLT_DEBUG_PARSING
5407  "xsltParseStylesheetTemplate: mode %s\n", mode);
5408 #endif
5409  if (mode != NULL) xmlFree(mode);
5410  if (modeURI != NULL) xmlFree(modeURI);
5411  }
5412  prop = xmlGetNsProp(template, (const xmlChar *)"match", NULL);
5413  if (prop != NULL) {
5414  if (ret->match != NULL) xmlFree(ret->match);
5415  ret->match = prop;
5416  }
5417 
5418  prop = xmlGetNsProp(template, (const xmlChar *)"priority", NULL);
5419  if (prop != NULL) {
5421  ret->priority = (float) priority;
5422  xmlFree(prop);
5423  }
5424 
5425  prop = xmlGetNsProp(template, (const xmlChar *)"name", NULL);
5426  if (prop != NULL) {
5427  const xmlChar *URI;
5428 
5429  /*
5430  * TODO: Don't use xsltGetQNameURI().
5431  */
5432  URI = xsltGetQNameURI(template, &prop);
5433  if (prop == NULL) {
5434  if (style != NULL) style->errors++;
5435  goto error;
5436  } else {
5437  if (xmlValidateNCName(prop,0)) {
5438  xsltTransformError(NULL, style, template,
5439  "xsl:template : error invalid name '%s'\n", prop);
5440  if (style != NULL) style->errors++;
5441  xmlFree(prop);
5442  goto error;
5443  }
5444  ret->name = xmlDictLookup(style->dict, BAD_CAST prop, -1);
5445  xmlFree(prop);
5446  prop = NULL;
5447  if (URI != NULL)
5448  ret->nameURI = xmlDictLookup(style->dict, BAD_CAST URI, -1);
5449  else
5450  ret->nameURI = NULL;
5451  }
5452  }
5453 
5454  /*
5455  * parse the content and register the pattern
5456  */
5457  xsltParseTemplateContent(style, template);
5458  ret->elem = template;
5459  ret->content = template->children;
5460  xsltAddTemplate(style, ret, ret->mode, ret->modeURI);
5461 
5462 error:
5463  return;
5464 }
#define error(str)
Definition: mkdosfs.c:1605
int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:2104
static int xsltGetInheritedNsList(xsltStylesheetPtr style, xsltTemplatePtr template, xmlNodePtr node)
Definition: xslt.c:1086
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:865
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
GLenum mode
Definition: glext.h:6217
static float(__cdecl *square_half_float)(float x
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:4882
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 6082 of file xslt.c.

6082  {
6083  xmlNodePtr cur;
6084  xmlChar *prop;
6085 #ifdef WITH_XSLT_DEBUG_PARSING
6086  int templates = 0;
6087 #endif
6088 
6089  if ((top == NULL) || (top->type != XML_ELEMENT_NODE))
6090  return;
6091 
6092  prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL);
6093  if (prop == NULL) {
6095  "xsl:version is missing: document may not be a stylesheet\n");
6096  if (style != NULL) style->warnings++;
6097  } else {
6098  if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
6099  (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
6101  "xsl:version: only 1.1 features are supported\n");
6102  if (style != NULL) {
6103  style->forwards_compatible = 1;
6104  style->warnings++;
6105  }
6106  }
6107  xmlFree(prop);
6108  }
6109 
6110  /*
6111  * process xsl:import elements
6112  */
6113  cur = top->children;
6114  while (cur != NULL) {
6115  if (IS_BLANK_NODE(cur)) {
6116  cur = cur->next;
6117  continue;
6118  }
6119  if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "import")) {
6120  if (xsltParseStylesheetImport(style, cur) != 0)
6121  if (style != NULL) style->errors++;
6122  } else
6123  break;
6124  cur = cur->next;
6125  }
6126 
6127  /*
6128  * process other top-level elements
6129  */
6130  while (cur != NULL) {
6131  if (IS_BLANK_NODE(cur)) {
6132  cur = cur->next;
6133  continue;
6134  }
6135  if (cur->type == XML_TEXT_NODE) {
6136  if (cur->content != NULL) {
6138  "misplaced text node: '%s'\n", cur->content);
6139  }
6140  if (style != NULL) style->errors++;
6141  cur = cur->next;
6142  continue;
6143  }
6144  if ((cur->type == XML_ELEMENT_NODE) && (cur->ns == NULL)) {
6146  "Found a top-level element %s with null namespace URI\n",
6147  cur->name);
6148  if (style != NULL) style->errors++;
6149  cur = cur->next;
6150  continue;
6151  }
6152  if ((cur->type == XML_ELEMENT_NODE) && (!(IS_XSLT_ELEM(cur)))) {
6153  xsltTopLevelFunction function;
6154 
6155  function = xsltExtModuleTopLevelLookup(cur->name,
6156  cur->ns->href);
6157  if (function != NULL)
6158  function(style, cur);
6159 
6160 #ifdef WITH_XSLT_DEBUG_PARSING
6162  "xsltParseStylesheetTop : found foreign element %s\n",
6163  cur->name);
6164 #endif
6165  cur = cur->next;
6166  continue;
6167  }
6168  if (IS_XSLT_NAME(cur, "import")) {
6170  "xsltParseStylesheetTop: ignoring misplaced import element\n");
6171  if (style != NULL) style->errors++;
6172  } else if (IS_XSLT_NAME(cur, "include")) {
6173  if (xsltParseStylesheetInclude(style, cur) != 0)
6174  if (style != NULL) style->errors++;
6175  } else if (IS_XSLT_NAME(cur, "strip-space")) {
6177  } else if (IS_XSLT_NAME(cur, "preserve-space")) {
6179  } else if (IS_XSLT_NAME(cur, "output")) {
6181  } else if (IS_XSLT_NAME(cur, "key")) {
6183  } else if (IS_XSLT_NAME(cur, "decimal-format")) {
6185  } else if (IS_XSLT_NAME(cur, "attribute-set")) {
6187  } else if (IS_XSLT_NAME(cur, "variable")) {
6189  } else if (IS_XSLT_NAME(cur, "param")) {
6191  } else if (IS_XSLT_NAME(cur, "template")) {
6192 #ifdef WITH_XSLT_DEBUG_PARSING
6193  templates++;
6194 #endif
6196  } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
6197  xsltNamespaceAlias(style, cur);
6198  } else {
6199  if ((style != NULL) && (style->forwards_compatible == 0)) {
6201  "xsltParseStylesheetTop: unknown %s element\n",
6202  cur->name);
6203  if (style != NULL) style->errors++;
6204  }
6205  }
6206  cur = cur->next;
6207  }
6208 #ifdef WITH_XSLT_DEBUG_PARSING
6210  "parsed %d templates\n", templates);
6211 #endif
6212 }
void xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: variables.c:2084
void xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1181
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:1665
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:54
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
int xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: imports.c:147
smooth NULL
Definition: ftsmooth.c:416
static void xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template)
Definition: xslt.c:5354
void * xsltGenericDebugContext
Definition: xsltutils.c:549
static void xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1526
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:5102
int xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: imports.c:49
static void xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: xslt.c:1399
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:39
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:2021
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().

◆ xsltParseStylesheetUser()

int xsltParseStylesheetUser ( xsltStylesheetPtr  style,
xmlDocPtr  doc 
)

xsltParseStylesheetUser: @style: pointer to the stylesheet @doc: an xmlDoc parsed XML

Parse an XSLT stylesheet with a user-provided stylesheet struct.

Returns 0 if successful, -1 in case of error.

Definition at line 6547 of file xslt.c.

6547  {
6548  if ((style == NULL) || (doc == NULL))
6549  return(-1);
6550 
6551  /*
6552  * Adjust the string dict.
6553  */
6554  if (doc->dict != NULL) {
6555  xmlDictFree(style->dict);
6556  style->dict = doc->dict;
6557 #ifdef WITH_XSLT_DEBUG
6559  "reusing dictionary from %s for stylesheet\n",
6560  doc->URL);
6561 #endif
6562  xmlDictReference(style->dict);
6563  }
6564 
6565  /*
6566  * TODO: Eliminate xsltGatherNamespaces(); we must not restrict
6567  * the stylesheet to containt distinct namespace prefixes.
6568  */
6570 
6571 #ifdef XSLT_REFACTORED
6572  {
6573  xsltCompilerCtxtPtr cctxt;
6574  xsltStylesheetPtr oldCurSheet;
6575 
6576  if (style->parent == NULL) {
6577  xsltPrincipalStylesheetDataPtr principalData;
6578  /*
6579  * Create extra data for the principal stylesheet.
6580  */
6581  principalData = xsltNewPrincipalStylesheetData();
6582  if (principalData == NULL) {
6583  return(-1);
6584  }
6585  style->principalData = principalData;
6586  /*
6587  * Create the compilation context
6588  * ------------------------------
6589  * (only once; for the principal stylesheet).
6590  * This is currently the only function where the
6591  * compilation context is created.
6592  */
6593  cctxt = xsltCompilationCtxtCreate(style);
6594  if (cctxt == NULL) {
6595  return(-1);
6596  }
6597  style->compCtxt = (void *) cctxt;
6598  cctxt->style = style;
6599  cctxt->dict = style->dict;
6600  cctxt->psData = principalData;
6601  /*
6602  * Push initial dummy node info.
6603  */
6604  cctxt->depth = -1;
6605  xsltCompilerNodePush(cctxt, (xmlNodePtr) doc);
6606  } else {
6607  /*
6608  * Imported stylesheet.
6609  */
6610  cctxt = style->parent->compCtxt;
6611  style->compCtxt = cctxt;
6612  }
6613  /*
6614  * Save the old and set the current stylesheet structure in the
6615  * compilation context.
6616  */
6617  oldCurSheet = cctxt->style;
6618  cctxt->style = style;
6619 
6620  style->doc = doc;
6622 
6623  cctxt->style = oldCurSheet;
6624  if (style->parent == NULL) {
6625  /*
6626  * Pop the initial dummy node info.
6627  */
6628  xsltCompilerNodePop(cctxt, (xmlNodePtr) doc);
6629  } else {
6630  /*
6631  * Clear the compilation context of imported
6632  * stylesheets.
6633  * TODO: really?
6634  */
6635  /* style->compCtxt = NULL; */
6636  }
6637 
6638 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
6639  if (style->errors != 0) {
6640  /*
6641  * Restore all changes made to namespace URIs of ns-decls.
6642  */
6643  if (cctxt->psData->nsMap)
6644  xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc);
6645  }
6646 #endif
6647 
6648  if (style->parent == NULL) {
6649  xsltCompilationCtxtFree(style->compCtxt);
6650  style->compCtxt = NULL;
6651  }
6652  }
6653 
6654 #else /* XSLT_REFACTORED */
6655  /*
6656  * Old behaviour.
6657  */
6658  style->doc = doc;
6659  if (xsltParseStylesheetProcess(style, doc) == NULL) {
6660  style->doc = NULL;
6661  return(-1);
6662  }
6663 #endif /* else of XSLT_REFACTORED */
6664 
6665  if (style->errors != 0) {
6666  /*
6667  * Detach the doc from the stylesheet; otherwise the doc
6668  * will be freed in xsltFreeStylesheet().
6669  */
6670  style->doc = NULL;
6671  /*
6672  * Cleanup the doc if its the main stylesheet.
6673  */
6674  if (style->parent == NULL)
6676  return(-1);
6677  }
6678 
6679  if (style->parent == NULL)
6681 
6682  return(0);
6683 }
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:645
const xmlChar * URL
Definition: tree.h:577
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:895
Definition: tree.h:489
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
Definition: dict.c:800
void xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style)
Definition: attributes.c:670
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
Arabic default style
Definition: afstyles.h:93
struct _xmlDict * dict
Definition: tree.h:580
xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc)
Definition: xslt.c:6410
static void xsltGatherNamespaces(xsltStylesheetPtr style)
Definition: xslt.c:3678

Referenced by xsltParseStylesheetImportedDoc().

◆ 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 4882 of file xslt.c.

4882  {
4883  xmlNodePtr cur, delete;
4884 
4885  if ((style == NULL) || (templ == NULL) ||
4886  (templ->type == XML_NAMESPACE_DECL)) return;
4887 
4888  /*
4889  * This content comes from the stylesheet
4890  * For stylesheets, the set of whitespace-preserving
4891  * element names consists of just xsl:text.
4892  */
4893  cur = templ->children;
4894  delete = NULL;
4895  while (cur != NULL) {
4896  if (delete != NULL) {
4897 #ifdef WITH_XSLT_DEBUG_BLANKS
4899  "xsltParseTemplateContent: removing text\n");
4900 #endif
4901  xmlUnlinkNode(delete);
4902  xmlFreeNode(delete);
4903  delete = NULL;
4904  }
4905  if (IS_XSLT_ELEM(cur)) {
4906  xsltStylePreCompute(style, cur);
4907 
4908  if (IS_XSLT_NAME(cur, "text")) {
4909  /*
4910  * TODO: Processing of xsl:text should be moved to
4911  * xsltPreprocessStylesheet(), since otherwise this
4912  * will be performed for every multiply included
4913  * stylesheet; i.e. this here is not skipped with
4914  * the use of the style->nopreproc flag.
4915  */
4916  if (cur->children != NULL) {
4917  xmlChar *prop;
4918  xmlNodePtr text = cur->children, next;
4919  int noesc = 0;
4920 
4921  prop = xmlGetNsProp(cur,
4922  (const xmlChar *)"disable-output-escaping",
4923  NULL);
4924  if (prop != NULL) {
4925 #ifdef WITH_XSLT_DEBUG_PARSING
4927  "Disable escaping: %s\n", text->content);
4928 #endif
4929  if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
4930  noesc = 1;
4931  } else if (!xmlStrEqual(prop,
4932  (const xmlChar *)"no")){
4934  "xsl:text: disable-output-escaping allows only yes or no\n");
4935  style->warnings++;
4936 
4937  }
4938  xmlFree(prop);
4939  }
4940 
4941  while (text != NULL) {
4942  if (text->type == XML_COMMENT_NODE) {
4943  text = text->next;
4944  continue;
4945  }
4946  if ((text->type != XML_TEXT_NODE) &&
4947  (text->type != XML_CDATA_SECTION_NODE)) {
4949  "xsltParseTemplateContent: xslt:text content problem\n");
4950  style->errors++;
4951  break;
4952  }
4953  if ((noesc) && (text->type != XML_CDATA_SECTION_NODE))
4954  text->name = xmlStringTextNoenc;
4955  text = text->next;
4956  }
4957 
4958  /*
4959  * replace xsl:text by the list of childs
4960  */
4961  if (text == NULL) {
4962  text = cur->children;
4963  while (text != NULL) {
4964  if ((style->internalized) &&
4965  (text->content != NULL) &&
4966  (!xmlDictOwns(style->dict, text->content))) {
4967 
4968  /*
4969  * internalize the text string
4970  */
4971  if (text->doc->dict != NULL) {
4972  const xmlChar *tmp;
4973 
4974  tmp = xmlDictLookup(text->doc->dict,
4975  text->content, -1);
4976  if (tmp != text->content) {
4978  text->content = (xmlChar *) tmp;
4979  }
4980  }
4981  }
4982 
4983  next = text->next;
4985  xmlAddPrevSibling(cur, text);
4986  text = next;
4987  }
4988  }
4989  }
4990  delete = cur;
4991  goto skip_children;
4992  }
4993  }
4994  else if ((cur->ns != NULL) && (style->nsDefs != NULL) &&
4995  (xsltCheckExtPrefix(style, cur->ns->prefix)))
4996  {
4997  /*
4998  * okay this is an extension element compile it too
4999  */
5000  xsltStylePreCompute(style, cur);
5001  }
5002  else if (cur->type == XML_ELEMENT_NODE)
5003  {
5004  /*
5005  * This is an element which will be output as part of the
5006  * template exectution, precompile AVT if found.
5007  */
5008  if ((cur->ns == NULL) && (style->defaultAlias != NULL)) {
5009  cur->ns = xmlSearchNsByHref(cur->doc, cur,
5010  style->defaultAlias);
5011  }
5012  if (cur->properties != NULL) {
5013  xmlAttrPtr attr = cur->properties;
5014 
5015  while (attr != NULL) {
5017  attr = attr->next;
5018  }
5019  }
5020  }
5021  /*
5022  * Skip to next node
5023  */
5024  if (cur->children != NULL) {
5025  if (cur->children->type != XML_ENTITY_DECL) {
5026  cur = cur->children;
5027  continue;
5028  }
5029  }
5030 skip_children:
5031  if (cur->next != NULL) {
5032  cur = cur->next;
5033  continue;
5034  }
5035 
5036  do {
5037  cur = cur->parent;
5038  if (cur == NULL)
5039  break;
5040  if (cur == templ) {
5041  cur = NULL;
5042  break;
5043  }
5044  if (cur->next != NULL) {
5045  cur = cur->next;
5046  break;
5047  }
5048  } while (cur != NULL);
5049  }
5050  if (delete != NULL) {
5051 #ifdef WITH_XSLT_DEBUG_PARSING
5053  "xsltParseTemplateContent: removing text\n");
5054 #endif
5055  xmlUnlinkNode(delete);
5056  xmlFreeNode(delete);
5057  delete = NULL;
5058  }
5059 
5060  /*
5061  * Skip the first params
5062  */
5063  cur = templ->children;
5064  while (cur != NULL) {
5065  if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param"))))
5066  break;
5067  cur = cur->next;
5068  }
5069 
5070  /*
5071  * Browse the remainder of the template
5072  */
5073  while (cur != NULL) {
5074  if ((IS_XSLT_ELEM(cur)) && (IS_XSLT_NAME(cur, "param"))) {
5075  xmlNodePtr param = cur;
5076 
5078  "xsltParseTemplateContent: ignoring misplaced param element\n");
5079  if (style != NULL) style->warnings++;
5080  cur = cur->next;
5082  xmlFreeNode(param);
5083  } else
5084  break;
5085  }
5086 }
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:865
Definition: cookie.c:201
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:1218
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:168

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

◆ xsltPreprocessStylesheet()

static void xsltPreprocessStylesheet ( xsltStylesheetPtr  style,
xmlNodePtr  cur 
)
static

Definition at line 3469 of file xslt.c.

3470 {
3471  xmlNodePtr deleteNode, styleelem;
3472  int internalize = 0;
3473 
3474  if ((style == NULL) || (cur == NULL))
3475  return;
3476 
3477  if ((cur->doc != NULL) && (style->dict != NULL) &&
3478  (cur->doc->dict == style->dict))
3479  internalize = 1;
3480  else
3481  style->internalized = 0;
3482 
3483  if ((cur != NULL) && (IS_XSLT_ELEM(cur)) &&
3484  (IS_XSLT_NAME(cur, "stylesheet"))) {
3485  styleelem = cur;
3486  } else {
3487  styleelem = NULL;
3488  }
3489 
3490  /*
3491  * This content comes from the stylesheet
3492  * For stylesheets, the set of whitespace-preserving
3493  * element names consists of just xsl:text.
3494  */
3495  deleteNode = NULL;
3496  while (cur != NULL) {
3497  if (deleteNode != NULL) {
3498 #ifdef WITH_XSLT_DEBUG_BLANKS
3500  "xsltPreprocessStylesheet: removing ignorable blank node\n");
3501 #endif
3502  xmlUnlinkNode(deleteNode);
3503  xmlFreeNode(deleteNode);
3504  deleteNode = NULL;
3505  }
3506  if (cur->type == XML_ELEMENT_NODE) {
3507  int exclPrefixes;
3508  /*
3509  * Internalize attributes values.
3510  */
3511  if ((internalize) && (cur->properties != NULL)) {
3512  xmlAttrPtr attr = cur->properties;
3513  xmlNodePtr txt;
3514 
3515  while (attr != NULL) {
3516  txt = attr->children;
3517  if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
3518  (txt->content != NULL) &&
3519  (!xmlDictOwns(style->dict, txt->content)))
3520  {
3521  xmlChar *tmp;
3522 
3523  /*
3524  * internalize the text string, goal is to speed
3525  * up operations and minimize used space by compiled
3526  * stylesheets.
3527  */
3528  tmp = (xmlChar *) xmlDictLookup(style->dict,
3529  txt->content, -1);
3530  if (tmp != txt->content) {
3531  xmlNodeSetContent(txt, NULL);
3532  txt->content = tmp;
3533  }
3534  }
3535  attr = attr->next;
3536  }
3537  }
3538  if (IS_XSLT_ELEM(cur)) {
3539  exclPrefixes = 0;
3540  if (IS_XSLT_NAME(cur, "text")) {
3541  for (;exclPrefixes > 0;exclPrefixes--)
3543  goto skip_children;
3544  }
3545  } else {
3546  exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0);
3547  }
3548 
3549  if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) {
3550  xmlNsPtr ns = cur->nsDef, prev = NULL, next;
3551  xmlNodePtr root = NULL;
3552  int i, moved;
3553 
3554  root = xmlDocGetRootElement(cur->doc);
3555  if ((root != NULL) && (root != cur)) {
3556  while (ns != NULL) {
3557  moved = 0;
3558  next = ns->next;
3559  for (i = 0;i < style->exclPrefixNr;i++) {
3560  if ((ns->prefix != NULL) &&
3561  (xmlStrEqual(ns->href,
3562  style->exclPrefixTab[i]))) {
3563  /*
3564  * Move the namespace definition on the root
3565  * element to avoid duplicating it without
3566  * loosing it.
3567  */
3568  if (prev == NULL) {
3569  cur->nsDef = ns->next;
3570  } else {
3571  prev->next = ns->next;
3572  }
3573  ns->next = root->nsDef;
3574  root->nsDef = ns;
3575  moved = 1;
3576  break;
3577  }
3578  }
3579  if (moved == 0)
3580  prev = ns;
3581  ns = next;
3582  }
3583  }
3584  }
3585  /*
3586  * If we have prefixes locally, recurse and pop them up when
3587  * going back
3588  */
3589  if (exclPrefixes > 0) {
3591  for (;exclPrefixes > 0;exclPrefixes--)
3593  goto skip_children;
3594  }
3595  } else if (cur->type == XML_TEXT_NODE) {
3596  if (IS_BLANK_NODE(cur)) {
3597  if (xmlNodeGetSpacePreserve(cur->parent) != 1) {
3598  deleteNode = cur;
3599  }
3600  } else if ((cur->content != NULL) && (internalize) &&
3601  (!xmlDictOwns(style->dict, cur->content))) {
3602  xmlChar *tmp;
3603 
3604  /*
3605  * internalize the text string, goal is to speed
3606  * up operations and minimize used space by compiled
3607  * stylesheets.
3608  */
3609  tmp = (xmlChar *) xmlDictLookup(style->dict, cur->content, -1);
3610  xmlNodeSetContent(cur, NULL);
3611  cur->content = tmp;
3612  }
3613  } else if ((cur->type != XML_ELEMENT_NODE) &&
3614  (cur->type != XML_CDATA_SECTION_NODE)) {
3615  deleteNode = cur;
3616  goto skip_children;
3617  }
3618 
3619  /*
3620  * Skip to next node. In case of a namespaced element children of
3621  * the stylesheet and not in the XSLT namespace and not an extension
3622  * element, ignore its content.
3623  */
3624  if ((cur->type == XML_ELEMENT_NODE) && (cur->ns != NULL) &&
3625  (styleelem != NULL) && (cur->parent == styleelem) &&
3626  (!xmlStrEqual(cur->ns->href, XSLT_NAMESPACE)) &&
3627  (!xsltCheckExtURI(style, cur->ns->href))) {
3628  goto skip_children;
3629  } else if (cur->children != NULL) {
3630  if ((cur->children->type != XML_ENTITY_DECL) &&
3631  (cur->children->type != XML_ENTITY_REF_NODE) &&
3632  (cur->children->type != XML_ENTITY_NODE)) {
3633  cur = cur->children;
3634  continue;
3635  }
3636  }
3637 
3638 skip_children:
3639  if (cur->next != NULL) {
3640  cur = cur->next;
3641  continue;
3642  }
3643  do {
3644 
3645  cur = cur->parent;
3646  if (cur == NULL)
3647  break;
3648  if (cur == (xmlNodePtr) style->doc) {
3649  cur = NULL;
3650  break;
3651  }
3652  if (cur->next != NULL) {
3653  cur = cur->next;
3654  break;
3655  }
3656  } while (cur != NULL);
3657  }
3658  if (deleteNode != NULL) {
3659 #ifdef WITH_XSLT_DEBUG_PARSING
3661  "xsltPreprocessStylesheet: removing ignorable blank node\n");
3662 #endif
3663  xmlUnlinkNode(deleteNode);
3664  xmlFreeNode(deleteNode);
3665  }
3666 }
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:3469
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:865
Definition: cookie.c:201
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:1735
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:1218
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.