ReactOS  0.4.15-dev-1377-ga59cecd
pattern.h File Reference
#include "xsltInternals.h"
#include "xsltexports.h"
Include dependency graph for pattern.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _xsltCompMatch xsltCompMatch
 
typedef xsltCompMatchxsltCompMatchPtr
 

Functions

XSLTPUBFUN xsltCompMatchPtr XSLTCALL xsltCompilePattern (const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime)
 
XSLTPUBFUN void XSLTCALL xsltFreeCompMatchList (xsltCompMatchPtr comp)
 
XSLTPUBFUN int XSLTCALL xsltTestCompMatchList (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltCompMatchPtr comp)
 
XSLTPUBFUN void XSLTCALL xsltCompMatchClearCache (xsltTransformContextPtr ctxt, xsltCompMatchPtr comp)
 
XSLTPUBFUN void XSLTCALL xsltNormalizeCompSteps (void *payload, void *data, const xmlChar *name)
 
XSLTPUBFUN int XSLTCALL xsltAddTemplate (xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI)
 
XSLTPUBFUN xsltTemplatePtr XSLTCALL xsltGetTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylesheetPtr style)
 
XSLTPUBFUN void XSLTCALL xsltFreeTemplateHashes (xsltStylesheetPtr style)
 
XSLTPUBFUN void XSLTCALL xsltCleanupTemplates (xsltStylesheetPtr style)
 

Typedef Documentation

◆ xsltCompMatch

xsltCompMatch:

Data structure used for the implementation of patterns. It is kept private (in pattern.c).

Definition at line 28 of file pattern.h.

◆ xsltCompMatchPtr

Definition at line 29 of file pattern.h.

Function Documentation

◆ xsltAddTemplate()

XSLTPUBFUN int XSLTCALL xsltAddTemplate ( xsltStylesheetPtr  style,
xsltTemplatePtr  cur,
const xmlChar mode,
const xmlChar modeURI 
)

xsltAddTemplate: @style: an XSLT stylesheet @cur: an XSLT template @mode: the mode name or NULL @modeURI: the mode URI or NULL

Register the XSLT pattern associated to @cur

Returns -1 in case of error, 0 otherwise

Definition at line 2104 of file pattern.c.

2105  {
2106  xsltCompMatchPtr pat, list, next;
2107  /*
2108  * 'top' will point to style->xxxMatch ptr - declaring as 'void'
2109  * avoids gcc 'type-punned pointer' warning.
2110  */
2111  void **top = NULL;
2112  const xmlChar *name = NULL;
2113  float priority; /* the priority */
2114 
2115  if ((style == NULL) || (cur == NULL))
2116  return(-1);
2117 
2118  /* Register named template */
2119  if (cur->name != NULL) {
2120  if (style->namedTemplates == NULL) {
2121  style->namedTemplates = xmlHashCreate(10);
2122  if (style->namedTemplates == NULL)
2123  return(-1);
2124  }
2125  else {
2126  void *dup = xmlHashLookup2(style->namedTemplates, cur->name,
2127  cur->nameURI);
2128  if (dup != NULL) {
2129  xsltTransformError(NULL, style, cur->elem,
2130  "xsl:template: error duplicate name '%s'\n",
2131  cur->name);
2132  style->errors++;
2133  return(-1);
2134  }
2135  }
2136 
2137  xmlHashAddEntry2(style->namedTemplates, cur->name, cur->nameURI, cur);
2138  }
2139 
2140  if (cur->match == NULL) {
2141  if (cur->name == NULL) {
2142  xsltTransformError(NULL, style, cur->elem,
2143  "xsl:template: need to specify match or name attribute\n");
2144  style->errors++;
2145  return(-1);
2146  }
2147  return(0);
2148  }
2149 
2150  priority = cur->priority;
2151  pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
2152  style, NULL, 1);
2153  if (pat == NULL)
2154  return(-1);
2155  while (pat) {
2156  next = pat->next;
2157  pat->next = NULL;
2158  name = NULL;
2159 
2160  pat->template = cur;
2161  if (mode != NULL)
2162  pat->mode = xmlDictLookup(style->dict, mode, -1);
2163  if (modeURI != NULL)
2164  pat->modeURI = xmlDictLookup(style->dict, modeURI, -1);
2166  pat->priority = priority;
2167 
2168  /*
2169  * insert it in the hash table list corresponding to its lookup name
2170  */
2171  switch (pat->steps[0].op) {
2172  case XSLT_OP_ATTR:
2173  if (pat->steps[0].value != NULL)
2174  name = pat->steps[0].value;
2175  else
2176  top = &(style->attrMatch);
2177  break;
2178  case XSLT_OP_PARENT:
2179  case XSLT_OP_ANCESTOR:
2180  top = &(style->elemMatch);
2181  break;
2182  case XSLT_OP_ROOT:
2183  top = &(style->rootMatch);
2184  break;
2185  case XSLT_OP_KEY:
2186  top = &(style->keyMatch);
2187  break;
2188  case XSLT_OP_ID:
2189  /* TODO optimize ID !!! */
2190  case XSLT_OP_NS:
2191  case XSLT_OP_ALL:
2192  top = &(style->elemMatch);
2193  break;
2194  case XSLT_OP_END:
2195  case XSLT_OP_PREDICATE:
2197  "xsltAddTemplate: invalid compiled pattern\n");
2198  xsltFreeCompMatch(pat);
2199  return(-1);
2200  /*
2201  * TODO: some flags at the top level about type based patterns
2202  * would be faster than inclusion in the hash table.
2203  */
2204  case XSLT_OP_PI:
2205  if (pat->steps[0].value != NULL)
2206  name = pat->steps[0].value;
2207  else
2208  top = &(style->piMatch);
2209  break;
2210  case XSLT_OP_COMMENT:
2211  top = &(style->commentMatch);
2212  break;
2213  case XSLT_OP_TEXT:
2214  top = &(style->textMatch);
2215  break;
2216  case XSLT_OP_ELEM:
2217  case XSLT_OP_NODE:
2218  if (pat->steps[0].value != NULL)
2219  name = pat->steps[0].value;
2220  else
2221  top = &(style->elemMatch);
2222  break;
2223  }
2224  if (name != NULL) {
2225  if (style->templatesHash == NULL) {
2226  style->templatesHash = xmlHashCreate(1024);
2227  if (style->templatesHash == NULL) {
2228  xsltFreeCompMatch(pat);
2229  return(-1);
2230  }
2231  xmlHashAddEntry3(style->templatesHash, name, mode, modeURI, pat);
2232  } else {
2233  list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash,
2234  name, mode, modeURI);
2235  if (list == NULL) {
2236  xmlHashAddEntry3(style->templatesHash, name,
2237  mode, modeURI, pat);
2238  } else {
2239  /*
2240  * Note '<=' since one must choose among the matching
2241  * template rules that are left, the one that occurs
2242  * last in the stylesheet
2243  */
2244  if (list->priority <= pat->priority) {
2245  pat->next = list;
2246  xmlHashUpdateEntry3(style->templatesHash, name,
2247  mode, modeURI, pat, NULL);
2248  } else {
2249  while (list->next != NULL) {
2250  if (list->next->priority <= pat->priority)
2251  break;
2252  list = list->next;
2253  }
2254  pat->next = list->next;
2255  list->next = pat;
2256  }
2257  }
2258  }
2259  } else if (top != NULL) {
2260  list = *top;
2261  if (list == NULL) {
2262  *top = pat;
2263  pat->next = NULL;
2264  } else if (list->priority <= pat->priority) {
2265  pat->next = list;
2266  *top = pat;
2267  } else {
2268  while (list->next != NULL) {
2269  if (list->next->priority <= pat->priority)
2270  break;
2271  list = list->next;
2272  }
2273  pat->next = list->next;
2274  list->next = pat;
2275  }
2276  } else {
2278  "xsltAddTemplate: invalid compiled pattern\n");
2279  xsltFreeCompMatch(pat);
2280  return(-1);
2281  }
2282 #ifdef WITH_XSLT_DEBUG_PATTERN
2283  if (mode)
2285  "added pattern : '%s' mode '%s' priority %f\n",
2286  pat->pattern, pat->mode, pat->priority);
2287  else
2289  "added pattern : '%s' priority %f\n",
2290  pat->pattern, pat->priority);
2291 #endif
2292 
2293  pat = next;
2294  }
2295  return(0);
2296 }
XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:536
xsltOp op
Definition: pattern.c:68
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:411
#define XSLT_PAT_NO_PRIORITY
const xmlChar * mode
Definition: pattern.c:85
static void xsltFreeCompMatch(xsltCompMatchPtr comp)
Definition: pattern.c:159
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:481
WDF_INTERRUPT_PRIORITY priority
xmlChar * value
Definition: pattern.c:69
struct _xsltCompMatch * next
Definition: pattern.c:82
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:774
const xmlChar * modeURI
Definition: pattern.c:86
void * xsltGenericDebugContext
Definition: xsltutils.c:549
static xsltCompMatchPtr xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime, int novar)
Definition: pattern.c:1904
struct list * next
Definition: list.h:38
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:865
float priority
Definition: pattern.c:83
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
const xmlChar * pattern
Definition: pattern.c:84
xsltCompMatch * xsltCompMatchPtr
Definition: pattern.h:29
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:181
XMLPUBFUN int XMLCALL xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f)
Definition: hash.c:652
xsltStepOpPtr steps
Definition: pattern.c:96
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: _list.h:228
GLenum mode
Definition: glext.h:6217
FxCollectionEntry * cur
static unsigned __int64 next
Definition: rand_nt.c:6
#define list
Definition: rosglue.h:35
#define NULL
Definition: types.h:112
Definition: name.c:38
_Check_return_ _CRTIMP int __cdecl dup(_In_ int _FileHandle)
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
xsltTemplatePtr template
Definition: pattern.c:87
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 xsltParseStylesheetTemplate().

◆ xsltCleanupTemplates()

XSLTPUBFUN void XSLTCALL xsltCleanupTemplates ( xsltStylesheetPtr style  ATTRIBUTE_UNUSED)

xsltCleanupTemplates: @style: an XSLT stylesheet

Cleanup the state of the templates used by the stylesheet and the ones it imports.

Definition at line 2590 of file pattern.c.

2590  {
2591 }

Referenced by xsltApplyStylesheetInternal().

◆ xsltCompilePattern()

XSLTPUBFUN xsltCompMatchPtr XSLTCALL xsltCompilePattern ( const xmlChar pattern,
xmlDocPtr  doc,
xmlNodePtr  node,
xsltStylesheetPtr  style,
xsltTransformContextPtr  runtime 
)

xsltCompilePattern: @pattern: an XSLT pattern @doc: the containing document @node: the containing element @style: the stylesheet @runtime: the transformation context, if done at run-time

Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching.

[1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

Returns the generated pattern list or NULL in case of failure

Definition at line 2080 of file pattern.c.

2082  {
2083  return (xsltCompilePatternInternal(pattern, doc, node, style, runtime, 0));
2084 }
static xsltCompMatchPtr xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime, int novar)
Definition: pattern.c:1904
Arabic default style
Definition: afstyles.h:93
GLubyte * pattern
Definition: glext.h:7787
Definition: dlist.c:348

Referenced by xsltNumberComp().

◆ xsltCompMatchClearCache()

XSLTPUBFUN void XSLTCALL xsltCompMatchClearCache ( xsltTransformContextPtr  ctxt,
xsltCompMatchPtr  comp 
)

xsltCompMatchClearCache: @ctxt: a XSLT process context @comp: the precompiled pattern list

Clear pattern match cache.

Definition at line 1235 of file pattern.c.

1235  {
1236  xsltStepOpPtr sel;
1237  xmlXPathObjectPtr list;
1238 
1239  if ((ctxt == NULL) || (comp == NULL))
1240  return;
1241 
1242  sel = &comp->steps[0];
1243  list = (xmlXPathObjectPtr) XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
1244 
1245  if (list != NULL) {
1246  xmlXPathFreeObject(list);
1247 
1248  XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) = NULL;
1249  XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = NULL;
1250  XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = 0;
1251  XSLT_RUNTIME_EXTRA_FREE(ctxt, sel->lenExtra) = NULL;
1252  }
1253 }
int indexExtra
Definition: pattern.c:77
#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr)
static PVOID ptr
Definition: dispmode.c:27
#define XSLT_RUNTIME_EXTRA(ctxt, nr, typ)
xsltStepOpPtr steps
Definition: pattern.c:96
Definition: _list.h:228
#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr)
int lenExtra
Definition: pattern.c:78
#define list
Definition: rosglue.h:35
#define NULL
Definition: types.h:112
int previousExtra
Definition: pattern.c:76

Referenced by xsltNumberFormat().

◆ xsltFreeCompMatchList()

XSLTPUBFUN void XSLTCALL xsltFreeCompMatchList ( xsltCompMatchPtr  comp)

xsltFreeCompMatchList: @comp: an XSLT comp list

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

Definition at line 192 of file pattern.c.

192  {
194 
195  while (comp != NULL) {
196  cur = comp;
197  comp = comp->next;
199  }
200 }
static void xsltFreeCompMatch(xsltCompMatchPtr comp)
Definition: pattern.c:159
struct _xsltCompMatch * next
Definition: pattern.c:82
FxCollectionEntry * cur
#define NULL
Definition: types.h:112

Referenced by xsltCompilePatternInternal(), xsltFreeCompMatchListEntry(), xsltFreeStylePreComp(), and xsltFreeTemplateHashes().

◆ xsltFreeTemplateHashes()

XSLTPUBFUN void XSLTCALL xsltFreeTemplateHashes ( xsltStylesheetPtr  style)

xsltFreeTemplateHashes: @style: an XSLT stylesheet

Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism

Definition at line 2600 of file pattern.c.

2600  {
2601  if (style->templatesHash != NULL)
2602  xmlHashFree((xmlHashTablePtr) style->templatesHash,
2604  if (style->rootMatch != NULL)
2605  xsltFreeCompMatchList(style->rootMatch);
2606  if (style->keyMatch != NULL)
2607  xsltFreeCompMatchList(style->keyMatch);
2608  if (style->elemMatch != NULL)
2609  xsltFreeCompMatchList(style->elemMatch);
2610  if (style->attrMatch != NULL)
2611  xsltFreeCompMatchList(style->attrMatch);
2612  if (style->parentMatch != NULL)
2613  xsltFreeCompMatchList(style->parentMatch);
2614  if (style->textMatch != NULL)
2615  xsltFreeCompMatchList(style->textMatch);
2616  if (style->piMatch != NULL)
2617  xsltFreeCompMatchList(style->piMatch);
2618  if (style->commentMatch != NULL)
2619  xsltFreeCompMatchList(style->commentMatch);
2620  if (style->namedTemplates != NULL)
2621  xmlHashFree(style->namedTemplates, NULL);
2622 }
void xsltFreeCompMatchList(xsltCompMatchPtr comp)
Definition: pattern.c:192
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:327
static void xsltFreeCompMatchListEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: pattern.c:203
#define NULL
Definition: types.h:112
Arabic default style
Definition: afstyles.h:93

Referenced by xsltFreeStylesheet().

◆ xsltGetTemplate()

xsltGetTemplate: @ctxt: a XSLT process context @node: the node being processed @style: the current style

Finds the template applying to this node, if @style is non-NULL it means one needs to look for the next imported template in scope.

Returns the xsltTemplatePtr or NULL if not found

Definition at line 2344 of file pattern.c.

2346 {
2347  xsltStylesheetPtr curstyle;
2349  const xmlChar *name = NULL;
2351  float priority;
2352  int keyed = 0;
2353 
2354  if ((ctxt == NULL) || (node == NULL))
2355  return(NULL);
2356 
2357  if (style == NULL) {
2358  curstyle = ctxt->style;
2359  } else {
2360  curstyle = xsltNextImport(style);
2361  }
2362 
2363  while ((curstyle != NULL) && (curstyle != style)) {
2365  /* TODO : handle IDs/keys here ! */
2366  if (curstyle->templatesHash != NULL) {
2367  /*
2368  * Use the top name as selector
2369  */
2370  switch (node->type) {
2371  case XML_ELEMENT_NODE:
2372  if (node->name[0] == ' ')
2373  break;
2374  /* Intentional fall-through */
2375  case XML_ATTRIBUTE_NODE:
2376  case XML_PI_NODE:
2377  name = node->name;
2378  break;
2379  case XML_DOCUMENT_NODE:
2381  case XML_TEXT_NODE:
2383  case XML_COMMENT_NODE:
2384  case XML_ENTITY_REF_NODE:
2385  case XML_ENTITY_NODE:
2388  case XML_NOTATION_NODE:
2389  case XML_DTD_NODE:
2390  case XML_ELEMENT_DECL:
2391  case XML_ATTRIBUTE_DECL:
2392  case XML_ENTITY_DECL:
2393  case XML_NAMESPACE_DECL:
2394  case XML_XINCLUDE_START:
2395  case XML_XINCLUDE_END:
2396  break;
2397  default:
2398  return(NULL);
2399 
2400  }
2401  }
2402  if (name != NULL) {
2403  /*
2404  * find the list of applicable expressions based on the name
2405  */
2407  name, ctxt->mode, ctxt->modeURI);
2408  } else
2409  list = NULL;
2410  while (list != NULL) {
2411  if (xsltTestCompMatch(ctxt, list, node,
2412  ctxt->mode, ctxt->modeURI) == 1) {
2413  ret = list->template;
2414  priority = list->priority;
2415  break;
2416  }
2417  list = list->next;
2418  }
2419  list = NULL;
2420 
2421  /*
2422  * find alternate generic matches
2423  */
2424  switch (node->type) {
2425  case XML_ELEMENT_NODE:
2426  if (node->name[0] == ' ')
2427  list = curstyle->rootMatch;
2428  else
2429  list = curstyle->elemMatch;
2430  if (node->psvi != NULL) keyed = 1;
2431  break;
2432  case XML_ATTRIBUTE_NODE: {
2433  xmlAttrPtr attr;
2434 
2435  list = curstyle->attrMatch;
2436  attr = (xmlAttrPtr) node;
2437  if (attr->psvi != NULL) keyed = 1;
2438  break;
2439  }
2440  case XML_PI_NODE:
2441  list = curstyle->piMatch;
2442  if (node->psvi != NULL) keyed = 1;
2443  break;
2444  case XML_DOCUMENT_NODE:
2445  case XML_HTML_DOCUMENT_NODE: {
2446  xmlDocPtr doc;
2447 
2448  list = curstyle->rootMatch;
2449  doc = (xmlDocPtr) node;
2450  if (doc->psvi != NULL) keyed = 1;
2451  break;
2452  }
2453  case XML_TEXT_NODE:
2455  list = curstyle->textMatch;
2456  if (node->psvi != NULL) keyed = 1;
2457  break;
2458  case XML_COMMENT_NODE:
2459  list = curstyle->commentMatch;
2460  if (node->psvi != NULL) keyed = 1;
2461  break;
2462  case XML_ENTITY_REF_NODE:
2463  case XML_ENTITY_NODE:
2466  case XML_NOTATION_NODE:
2467  case XML_DTD_NODE:
2468  case XML_ELEMENT_DECL:
2469  case XML_ATTRIBUTE_DECL:
2470  case XML_ENTITY_DECL:
2471  case XML_NAMESPACE_DECL:
2472  case XML_XINCLUDE_START:
2473  case XML_XINCLUDE_END:
2474  break;
2475  default:
2476  break;
2477  }
2478  while ((list != NULL) &&
2479  ((ret == NULL) || (list->priority > priority))) {
2480  if (xsltTestCompMatch(ctxt, list, node,
2481  ctxt->mode, ctxt->modeURI) == 1) {
2482  ret = list->template;
2483  priority = list->priority;
2484  break;
2485  }
2486  list = list->next;
2487  }
2488  /*
2489  * Some of the tests for elements can also apply to documents
2490  */
2491  if ((node->type == XML_DOCUMENT_NODE) ||
2492  (node->type == XML_HTML_DOCUMENT_NODE) ||
2493  (node->type == XML_TEXT_NODE)) {
2494  list = curstyle->elemMatch;
2495  while ((list != NULL) &&
2496  ((ret == NULL) || (list->priority > priority))) {
2497  if (xsltTestCompMatch(ctxt, list, node,
2498  ctxt->mode, ctxt->modeURI) == 1) {
2499  ret = list->template;
2500  priority = list->priority;
2501  break;
2502  }
2503  list = list->next;
2504  }
2505  } else if ((node->type == XML_PI_NODE) ||
2506  (node->type == XML_COMMENT_NODE)) {
2507  list = curstyle->elemMatch;
2508  while ((list != NULL) &&
2509  ((ret == NULL) || (list->priority > priority))) {
2510  if (xsltTestCompMatch(ctxt, list, node,
2511  ctxt->mode, ctxt->modeURI) == 1) {
2512  ret = list->template;
2513  priority = list->priority;
2514  break;
2515  }
2516  list = list->next;
2517  }
2518  }
2519 
2520 keyed_match:
2521  if (keyed) {
2522  list = curstyle->keyMatch;
2523  while ((list != NULL) &&
2524  ((ret == NULL) || (list->priority > priority))) {
2525  if (xsltTestCompMatch(ctxt, list, node,
2526  ctxt->mode, ctxt->modeURI) == 1) {
2527  ret = list->template;
2528  priority = list->priority;
2529  break;
2530  }
2531  list = list->next;
2532  }
2533  }
2534  else if (ctxt->hasTemplKeyPatterns &&
2535  ((ctxt->document == NULL) ||
2536  (ctxt->document->nbKeysComputed < ctxt->nbKeys)))
2537  {
2538  /*
2539  * Compute all remaining keys for this document.
2540  *
2541  * REVISIT TODO: I think this could be further optimized.
2542  */
2543  if (xsltComputeAllKeys(ctxt, node) == -1)
2544  goto error;
2545 
2546  switch (node->type) {
2547  case XML_ELEMENT_NODE:
2548  if (node->psvi != NULL) keyed = 1;
2549  break;
2550  case XML_ATTRIBUTE_NODE:
2551  if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1;
2552  break;
2553  case XML_TEXT_NODE:
2555  case XML_COMMENT_NODE:
2556  case XML_PI_NODE:
2557  if (node->psvi != NULL) keyed = 1;
2558  break;
2559  case XML_DOCUMENT_NODE:
2561  if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
2562  break;
2563  default:
2564  break;
2565  }
2566  if (keyed)
2567  goto keyed_match;
2568  }
2569  if (ret != NULL)
2570  return(ret);
2571 
2572  /*
2573  * Cycle on next curstylesheet import.
2574  */
2575  curstyle = xsltNextImport(curstyle);
2576  }
2577 
2578 error:
2579  return(NULL);
2580 }
#define error(str)
Definition: mkdosfs.c:1605
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:251
#define XSLT_PAT_NO_PRIORITY
struct node node
WDF_INTERRUPT_PRIORITY priority
xsltDocumentPtr document
static int xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr matchNode, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:900
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:774
const xmlChar * modeURI
void * psvi
Definition: tree.h:581
struct list * next
Definition: list.h:38
Definition: cookie.c:201
xsltCompMatch * xsltCompMatchPtr
Definition: pattern.h:29
int ret
xmlAttr * xmlAttrPtr
Definition: tree.h:433
__u8 attr
Definition: mkdosfs.c:359
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: _list.h:228
xmlDoc * xmlDocPtr
Definition: tree.h:550
xsltStylesheetPtr style
static int xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode)
Definition: pattern.c:2299
const xmlChar * mode
#define NULL
Definition: types.h:112
Definition: tree.h:551
Definition: tree.h:434
Definition: name.c:38
Arabic default style
Definition: afstyles.h:93
Definition: dlist.c:348

Referenced by xsltApplyImports(), xsltDefaultProcessOneNode(), and xsltProcessOneNode().

◆ xsltNormalizeCompSteps()

XSLTPUBFUN void XSLTCALL xsltNormalizeCompSteps ( void payload,
void data,
const xmlChar name 
)

◆ xsltTestCompMatchList()

XSLTPUBFUN int XSLTCALL xsltTestCompMatchList ( xsltTransformContextPtr  ctxt,
xmlNodePtr  node,
xsltCompMatchPtr  comp 
)

xsltTestCompMatchList: @ctxt: a XSLT process context @node: a node @comp: the precompiled pattern list

Test whether the node matches one of the patterns in the list

Returns 1 if it matches, 0 if it doesn't and -1 in case of failure

Definition at line 1212 of file pattern.c.

1213  {
1214  int ret;
1215 
1216  if ((ctxt == NULL) || (node == NULL))
1217  return(-1);
1218  while (comp != NULL) {
1219  ret = xsltTestCompMatch(ctxt, comp, node, NULL, NULL);
1220  if (ret == 1)
1221  return(1);
1222  comp = comp->next;
1223  }
1224  return(0);
1225 }
struct _xsltCompMatch * next
Definition: pattern.c:82
static int xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr matchNode, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:900
int ret
#define NULL
Definition: types.h:112
Definition: dlist.c:348

Referenced by xsltNumberFormatGetAnyLevel(), xsltNumberFormatGetMultipleLevel(), and xsltTestCompMatchCount().