14 #ifdef WITH_XSLT_DEBUG 15 #define WITH_XSLT_DEBUG_KEYS 44 "xsltNewKeyDef : malloc failed\n");
67 xmlXPathFreeCompExpr(keyd->
comp);
69 xmlXPathFreeCompExpr(keyd->
usecomp);
94 while (keyd !=
NULL) {
117 "xsltNewKeyTable : malloc failed\n");
131 xmlXPathFreeNodeSet((xmlNodeSetPtr) payload);
164 while (keyt !=
NULL) {
237 }
else if (
cur[
end] ==
'[') {
239 }
else if (
cur[
end] ==
']') {
273 #ifdef WITH_XSLT_DEBUG_KEYS 275 "Add key %s, match %s, use %s\n",
name,
match, use);
282 key->nsList = xmlGetNsList(inst->
doc, inst);
303 "xsl:key : 'match' pattern is malformed: %s",
313 "xsl:key : 'match' pattern is empty\n");
338 "xsl:key : 'match' pattern is empty\n");
342 #ifdef WITH_XSLT_DEBUG_KEYS 344 " resulting pattern %s\n",
pattern);
354 #ifdef XML_XPATH_NOVAR 361 "xsl:key : 'match' pattern compilation failed '%s'\n",
365 #ifdef XML_XPATH_NOVAR 372 "xsl:key : 'use' expression compilation failed '%s'\n",
427 #ifdef WITH_XSLT_DEBUG_KEYS 486 #ifdef KEY_INIT_DEBUG 495 (nameURI !=
NULL)) &&
509 #ifdef WITH_XSLT_DEBUG_KEYS 511 "xsltInitDocKeyTable: did not found %s\n",
name));
514 "Failed to find key definition for %s\n",
name);
518 #ifdef KEY_INIT_DEBUG 544 #ifdef KEY_INIT_DEBUG 560 #ifdef KEY_INIT_DEBUG 587 #ifdef KEY_INIT_DEBUG 609 xmlXPathObjectPtr matchRes =
NULL, useRes =
NULL;
615 int oldXPPos, oldXPSize;
620 xmlXPathContextPtr xpctxt;
622 #ifdef KEY_INIT_DEBUG 633 #ifdef WITH_XSLT_DEBUG_KEYS 636 "xsltInitCtxtKey: key definition of %s is recursive\n",
640 "Key definition for %s is recursive\n", keyDef->
name);
651 oldInst = ctxt->
inst;
653 oldContextNode = ctxt->
node;
655 oldXPNode = xpctxt->node;
656 oldXPDoc = xpctxt->
doc;
657 oldXPPos = xpctxt->proximityPosition;
658 oldXPSize = xpctxt->contextSize;
659 oldXPNsNr = xpctxt->nsNr;
660 oldXPNamespaces = xpctxt->namespaces;
672 xpctxt->namespaces = keyDef->
nsList;
673 xpctxt->nsNr = keyDef->
nsNr;
679 matchRes = xmlXPathCompiledEval(keyDef->
comp, xpctxt);
680 if (matchRes ==
NULL) {
682 #ifdef WITH_XSLT_DEBUG_KEYS 684 "xsltInitCtxtKey: %s evaluation failed\n", keyDef->
match));
687 "Failed to evaluate the 'match' expression.\n");
691 if (matchRes->type == XPATH_NODESET) {
692 matchList = matchRes->nodesetval;
694 #ifdef WITH_XSLT_DEBUG_KEYS 695 if (matchList !=
NULL)
697 "xsltInitCtxtKey: %s evaluates to %d nodes\n",
698 keyDef->
match, matchList->nodeNr));
704 #ifdef WITH_XSLT_DEBUG_KEYS 706 "xsltInitCtxtKey: %s is not a node set\n", keyDef->
match));
709 "The 'match' expression did not evaluate to a node set.\n");
714 if ((matchList ==
NULL) || (matchList->nodeNr <= 0))
748 xpctxt->contextSize = 1;
749 xpctxt->proximityPosition = 1;
751 for (
i = 0;
i < matchList->nodeNr;
i++) {
752 cur = matchList->nodeTab[
i];
765 xmlXPathFreeObject(useRes);
766 useRes = xmlXPathCompiledEval(keyDef->
usecomp, xpctxt);
767 if (useRes ==
NULL) {
769 "Failed to evaluate the 'use' expression.\n");
773 if (useRes->type == XPATH_NODESET) {
774 if ((useRes->nodesetval !=
NULL) &&
775 (useRes->nodesetval->nodeNr != 0))
777 len = useRes->nodesetval->nodeNr;
778 str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[0]);
784 if (useRes->type == XPATH_STRING) {
788 str = useRes->stringval;
789 useRes->stringval =
NULL;
791 str = xmlXPathCastToString(useRes);
802 #ifdef WITH_XSLT_DEBUG_KEYS 804 "xsl:key : node associated to ('%s', '%s')\n", keyDef->
name,
str));
844 str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[
k]);
854 xpctxt->node = oldXPNode;
855 xpctxt->
doc = oldXPDoc;
856 xpctxt->nsNr = oldXPNsNr;
857 xpctxt->namespaces = oldXPNamespaces;
858 xpctxt->proximityPosition = oldXPPos;
859 xpctxt->contextSize = oldXPSize;
861 ctxt->
node = oldContextNode;
863 ctxt->
inst = oldInst;
868 xmlXPathFreeObject(useRes);
869 if (matchRes !=
NULL)
870 xmlXPathFreeObject(matchRes);
888 if ((ctxt ==
NULL) || (idoc ==
NULL))
891 #ifdef KEY_INIT_DEBUG 895 #ifdef WITH_XSLT_DEBUG_KEYS 906 keyDef = keyDef->
next;
912 #ifdef KEY_INIT_DEBUG
static int xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI)
int xsltAddKey(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *nameURI, const xmlChar *match, const xmlChar *use, xmlNodePtr inst)
xsltKeyTable * xsltKeyTablePtr
xmlXPathCompExprPtr usecomp
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
xsltKeyDef * xsltKeyDefPtr
static xsltKeyDefPtr xsltNewKeyDef(const xmlChar *name, const xmlChar *nameURI)
int xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc, xsltKeyDefPtr keyDef)
xmlXPathCompExprPtr xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str)
GLenum GLsizei GLenum GLenum const GLvoid * table
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
struct _xsltKeyTable * next
static int skipPredicate(const xmlChar *cur, int end)
xmlXPathContextPtr xpathCtxt
void * xsltGenericDebugContext
xmlNodeSetPtr xsltGetKey(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI, const xmlChar *value)
XMLPUBFUN xmlChar *XMLCALL xmlStrncat(xmlChar *cur, const xmlChar *add, int len)
#define IS_XSLT_REAL_NODE(n)
XMLPUBVAR xmlFreeFunc xmlFree
xmlGenericErrorFunc xsltGenericDebug
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
#define XSLT_TRACE(ctxt, code, call)
static void xsltFreeKeyDef(xsltKeyDefPtr keyd)
void xsltFreeKeys(xsltStylesheetPtr style)
static int skipString(const xmlChar *cur, int end)
void xsltFreeDocumentKeys(xsltDocumentPtr idoc)
static xsltKeyTablePtr xsltNewKeyTable(const xmlChar *name, const xmlChar *nameURI)
int xsltInitAllDocKeys(xsltTransformContextPtr ctxt)
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
void xsltInitCtxtKeys(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc)
struct _xsltKeyDef * next
XMLPUBVAR xmlMallocFunc xmlMalloc
xmlXPathCompExprPtr xsltXPathCompileFlags(xsltStylesheetPtr style, const xmlChar *str, int flags)
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
static void xsltFreeKeyDefList(xsltKeyDefPtr keyd)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
static void xsltFreeNodeSetEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
static void xsltFreeKeyTableList(xsltKeyTablePtr keyt)
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
static void xsltFreeKeyTable(xsltKeyTablePtr keyt)
struct task_struct * current