ReactOS 0.4.16-dev-2175-g9420ab7
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 2030 of file pattern.c.

2031 {
2033 /*
2034 * 'top' will point to style->xxxMatch ptr - declaring as 'void'
2035 * avoids gcc 'type-punned pointer' warning.
2036 */
2038 const xmlChar *name = NULL;
2039 float priority; /* the priority */
2040
2041 if ((style == NULL) || (cur == NULL))
2042 return(-1);
2043
2044 if (cur->next != NULL)
2045 cur->position = cur->next->position + 1;
2046
2047 /* Register named template */
2048 if (cur->name != NULL) {
2049 if (style->namedTemplates == NULL) {
2050 style->namedTemplates = xmlHashCreate(10);
2051 if (style->namedTemplates == NULL)
2052 return(-1);
2053 }
2054 else {
2055 void *dup = xmlHashLookup2(style->namedTemplates, cur->name,
2056 cur->nameURI);
2057 if (dup != NULL) {
2059 "xsl:template: error duplicate name '%s'\n",
2060 cur->name);
2061 style->errors++;
2062 return(-1);
2063 }
2064 }
2065
2066 xmlHashAddEntry2(style->namedTemplates, cur->name, cur->nameURI, cur);
2067 }
2068
2069 if (cur->match == NULL) {
2070 if (cur->name == NULL) {
2072 "xsl:template: need to specify match or name attribute\n");
2073 style->errors++;
2074 return(-1);
2075 }
2076 return(0);
2077 }
2078
2079 priority = cur->priority;
2080 pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
2081 style, NULL, 1);
2082 if (pat == NULL)
2083 return(-1);
2084 while (pat) {
2085 int success = 0;
2086
2087 next = pat->next;
2088 pat->next = NULL;
2089 name = NULL;
2090
2091 pat->template = cur;
2092 if (mode != NULL)
2093 pat->mode = xmlDictLookup(style->dict, mode, -1);
2094 if (modeURI != NULL)
2095 pat->modeURI = xmlDictLookup(style->dict, modeURI, -1);
2097 pat->priority = priority;
2098
2099 /*
2100 * insert it in the hash table list corresponding to its lookup name
2101 */
2102 switch (pat->steps[0].op) {
2103 case XSLT_OP_ATTR:
2104 if (pat->steps[0].value != NULL)
2105 name = pat->steps[0].value;
2106 else
2107 top = &(style->attrMatch);
2108 break;
2109 case XSLT_OP_PARENT:
2110 case XSLT_OP_ANCESTOR:
2111 top = &(style->elemMatch);
2112 break;
2113 case XSLT_OP_ROOT:
2114 top = &(style->rootMatch);
2115 break;
2116 case XSLT_OP_KEY:
2117 top = &(style->keyMatch);
2118 break;
2119 case XSLT_OP_ID:
2120 /* TODO optimize ID !!! */
2121 case XSLT_OP_NS:
2122 case XSLT_OP_ALL:
2123 top = &(style->elemMatch);
2124 break;
2125 case XSLT_OP_END:
2126 case XSLT_OP_PREDICATE:
2128 "xsltAddTemplate: invalid compiled pattern\n");
2129 xsltFreeCompMatch(pat);
2130 return(-1);
2131 /*
2132 * TODO: some flags at the top level about type based patterns
2133 * would be faster than inclusion in the hash table.
2134 */
2135 case XSLT_OP_PI:
2136 if (pat->steps[0].value != NULL)
2137 name = pat->steps[0].value;
2138 else
2139 top = &(style->piMatch);
2140 break;
2141 case XSLT_OP_COMMENT:
2142 top = &(style->commentMatch);
2143 break;
2144 case XSLT_OP_TEXT:
2145 top = &(style->textMatch);
2146 break;
2147 case XSLT_OP_ELEM:
2148 case XSLT_OP_NODE:
2149 if (pat->steps[0].value != NULL)
2150 name = pat->steps[0].value;
2151 else
2152 top = &(style->elemMatch);
2153 break;
2154 }
2155 if (name != NULL) {
2156 if (style->templatesHash == NULL) {
2157 style->templatesHash = xmlHashCreate(1024);
2158 success = (style->templatesHash != NULL) &&
2159 (xmlHashAddEntry3(style->templatesHash, name, mode,
2160 modeURI, pat) >= 0);
2161 } else {
2162 list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash,
2163 name, mode, modeURI);
2164 if (list == NULL) {
2165 success = (xmlHashAddEntry3(style->templatesHash, name,
2166 mode, modeURI, pat) >= 0);
2167 } else {
2168 /*
2169 * Note '<=' since one must choose among the matching
2170 * template rules that are left, the one that occurs
2171 * last in the stylesheet
2172 */
2173 if (list->priority <= pat->priority) {
2174 pat->next = list;
2175 xmlHashUpdateEntry3(style->templatesHash, name,
2176 mode, modeURI, pat, NULL);
2177 } else {
2178 while (list->next != NULL) {
2179 if (list->next->priority <= pat->priority)
2180 break;
2181 list = list->next;
2182 }
2183 pat->next = list->next;
2184 list->next = pat;
2185 }
2186 success = 1;
2187 }
2188 }
2189 } else if (top != NULL) {
2190 list = *top;
2191 if (list == NULL) {
2192 *top = pat;
2193 pat->next = NULL;
2194 } else if (list->priority <= pat->priority) {
2195 pat->next = list;
2196 *top = pat;
2197 } else {
2198 while (list->next != NULL) {
2199 if (list->next->priority <= pat->priority)
2200 break;
2201 list = list->next;
2202 }
2203 pat->next = list->next;
2204 list->next = pat;
2205 }
2206 success = 1;
2207 }
2208 if (success == 0) {
2210 "xsltAddTemplate: invalid compiled pattern\n");
2211 xsltFreeCompMatch(pat);
2213 return(-1);
2214 }
2215#ifdef WITH_XSLT_DEBUG_PATTERN
2216 if (mode)
2218 "added pattern : '%s' mode '%s' priority %f\n",
2219 pat->pattern, pat->mode, pat->priority);
2220 else
2222 "added pattern : '%s' priority %f\n",
2223 pat->pattern, pat->priority);
2224#endif
2225
2226 pat = next;
2227 }
2228 return(0);
2229}
Arabic default style
Definition: afstyles.h:94
Definition: list.h:37
struct list * next
Definition: list.h:38
#define NULL
Definition: types.h:112
static xsltCompMatchPtr xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime, int novar)
Definition: pattern.c:1830
void xsltFreeCompMatchList(xsltCompMatchPtr comp)
Definition: pattern.c:211
static void xsltFreeCompMatch(xsltCompMatchPtr comp)
Definition: pattern.c:178
@ XSLT_OP_PREDICATE
Definition: pattern.c:61
@ XSLT_OP_PARENT
Definition: pattern.c:51
@ XSLT_OP_TEXT
Definition: pattern.c:59
@ XSLT_OP_END
Definition: pattern.c:47
@ XSLT_OP_ID
Definition: pattern.c:53
@ XSLT_OP_ALL
Definition: pattern.c:56
@ XSLT_OP_ELEM
Definition: pattern.c:49
@ XSLT_OP_NODE
Definition: pattern.c:60
@ XSLT_OP_ATTR
Definition: pattern.c:50
@ XSLT_OP_PI
Definition: pattern.c:57
@ XSLT_OP_COMMENT
Definition: pattern.c:58
@ XSLT_OP_KEY
Definition: pattern.c:54
@ XSLT_OP_ANCESTOR
Definition: pattern.c:52
@ XSLT_OP_ROOT
Definition: pattern.c:48
@ XSLT_OP_NS
Definition: pattern.c:55
FxCollectionEntry * cur
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum mode
Definition: glext.h:6217
xsltCompMatch * xsltCompMatchPtr
Definition: pattern.h:29
#define dup
Definition: syshdrs.h:51
static int priority
Definition: timer.c:163
static unsigned __int64 next
Definition: rand_nt.c:6
#define list
Definition: rosglue.h:35
const xmlChar * xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:824
void * xmlHashLookup2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2)
Definition: hash.c:754
xmlHashTablePtr xmlHashCreate(int size)
Definition: hash.c:160
int xmlHashUpdateEntry3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, void *payload, xmlHashDeallocator dealloc)
Definition: hash.c:722
int xmlHashAddEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload)
Definition: hash.c:639
int xmlHashAddEntry3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3, void *payload)
Definition: hash.c:659
void * xmlHashLookup3(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, const xmlChar *key3)
Definition: hash.c:806
const xmlChar * pattern
Definition: pattern.c:103
struct _xsltCompMatch * next
Definition: pattern.c:101
xsltTemplatePtr template
Definition: pattern.c:106
xsltStepOpPtr steps
Definition: pattern.c:115
const xmlChar * mode
Definition: pattern.c:104
float priority
Definition: pattern.c:102
const xmlChar * modeURI
Definition: pattern.c:105
xmlChar * value
Definition: pattern.c:88
xsltOp op
Definition: pattern.c:87
Definition: name.c:39
#define success(from, fromstr, to, tostr)
unsigned char xmlChar
Definition: xmlstring.h:28
#define XSLT_PAT_NO_PRIORITY
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:762
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:632
void * xsltGenericDebugContext
Definition: xsltutils.c:633

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 2502 of file pattern.c.

2502 {
2503}

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 2006 of file pattern.c.

2008 {
2009 return (xsltCompilePatternInternal(pattern, doc, node, style, runtime, 0));
2010}
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 1155 of file pattern.c.

1155 {
1156 xsltStepOpPtr sel;
1157 xmlXPathObjectPtr list;
1158
1159 if ((ctxt == NULL) || (comp == NULL))
1160 return;
1161
1162 sel = &comp->steps[0];
1163 list = (xmlXPathObjectPtr) XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
1164
1165 if (list != NULL) {
1166 xmlXPathFreeObject(list);
1167
1168 XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) = NULL;
1170 XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = 0;
1172 }
1173}
static PVOID ptr
Definition: dispmode.c:27
int indexExtra
Definition: pattern.c:96
int lenExtra
Definition: pattern.c:97
int previousExtra
Definition: pattern.c:95
#define XSLT_RUNTIME_EXTRA(ctxt, nr, typ)
#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr)
#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr)

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 211 of file pattern.c.

211 {
213
214 while (comp != NULL) {
215 cur = comp;
216 comp = comp->next;
218 }
219}

Referenced by xsltAddTemplate(), 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 2512 of file pattern.c.

2512 {
2513 if (style->templatesHash != NULL)
2515 if (style->rootMatch != NULL)
2516 xsltFreeCompMatchList(style->rootMatch);
2517 if (style->keyMatch != NULL)
2518 xsltFreeCompMatchList(style->keyMatch);
2519 if (style->elemMatch != NULL)
2520 xsltFreeCompMatchList(style->elemMatch);
2521 if (style->attrMatch != NULL)
2522 xsltFreeCompMatchList(style->attrMatch);
2523 if (style->parentMatch != NULL)
2524 xsltFreeCompMatchList(style->parentMatch);
2525 if (style->textMatch != NULL)
2526 xsltFreeCompMatchList(style->textMatch);
2527 if (style->piMatch != NULL)
2528 xsltFreeCompMatchList(style->piMatch);
2529 if (style->commentMatch != NULL)
2530 xsltFreeCompMatchList(style->commentMatch);
2531 if (style->namedTemplates != NULL)
2532 xmlHashFree(style->namedTemplates, NULL);
2533}
static void xsltFreeCompMatchListEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: pattern.c:222
void xmlHashFree(xmlHashTablePtr hash, xmlHashDeallocator dealloc)
Definition: hash.c:229

Referenced by xsltFreeStylesheet().

◆ xsltGetTemplate()

XSLTPUBFUN xsltTemplatePtr XSLTCALL xsltGetTemplate ( xsltTransformContextPtr  ctxt,
xmlNodePtr  node,
xsltStylesheetPtr  style 
)

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 2277 of file pattern.c.

2279{
2280 xsltStylesheetPtr curstyle;
2282 const xmlChar *name = NULL;
2284 float priority;
2285
2286 if ((ctxt == NULL) || (node == NULL))
2287 return(NULL);
2288
2289 if (style == NULL) {
2290 curstyle = ctxt->style;
2291 } else {
2292 curstyle = xsltNextImport(style);
2293 }
2294
2295 while ((curstyle != NULL) && (curstyle != style)) {
2297 /* TODO : handle IDs/keys here ! */
2298 if (curstyle->templatesHash != NULL) {
2299 /*
2300 * Use the top name as selector
2301 */
2302 switch (node->type) {
2303 case XML_ELEMENT_NODE:
2304 if (node->name[0] == ' ')
2305 break;
2306 /* Intentional fall-through */
2307 case XML_ATTRIBUTE_NODE:
2308 case XML_PI_NODE:
2309 name = node->name;
2310 break;
2311 case XML_DOCUMENT_NODE:
2312 case XML_HTML_DOCUMENT_NODE:
2313 case XML_TEXT_NODE:
2314 case XML_CDATA_SECTION_NODE:
2315 case XML_COMMENT_NODE:
2316 case XML_ENTITY_REF_NODE:
2317 case XML_ENTITY_NODE:
2318 case XML_DOCUMENT_TYPE_NODE:
2319 case XML_DOCUMENT_FRAG_NODE:
2320 case XML_NOTATION_NODE:
2321 case XML_DTD_NODE:
2322 case XML_ELEMENT_DECL:
2323 case XML_ATTRIBUTE_DECL:
2324 case XML_ENTITY_DECL:
2325 case XML_NAMESPACE_DECL:
2326 case XML_XINCLUDE_START:
2327 case XML_XINCLUDE_END:
2328 break;
2329 default:
2330 return(NULL);
2331
2332 }
2333 }
2334 if (name != NULL) {
2335 /*
2336 * find the list of applicable expressions based on the name
2337 */
2339 name, ctxt->mode, ctxt->modeURI);
2340 } else
2341 list = NULL;
2342 while (list != NULL) {
2343 if (xsltTestCompMatch(ctxt, list, node,
2344 ctxt->mode, ctxt->modeURI) == 1) {
2345 ret = list->template;
2346 priority = list->priority;
2347 break;
2348 }
2349 list = list->next;
2350 }
2351 list = NULL;
2352
2353 /*
2354 * find alternate generic matches
2355 */
2356 switch (node->type) {
2357 case XML_ELEMENT_NODE:
2358 if (node->name[0] == ' ')
2359 list = curstyle->rootMatch;
2360 else
2361 list = curstyle->elemMatch;
2362 break;
2363 case XML_ATTRIBUTE_NODE: {
2364 list = curstyle->attrMatch;
2365 break;
2366 }
2367 case XML_PI_NODE:
2368 list = curstyle->piMatch;
2369 break;
2370 case XML_DOCUMENT_NODE:
2371 case XML_HTML_DOCUMENT_NODE: {
2372 list = curstyle->rootMatch;
2373 break;
2374 }
2375 case XML_TEXT_NODE:
2376 case XML_CDATA_SECTION_NODE:
2377 list = curstyle->textMatch;
2378 break;
2379 case XML_COMMENT_NODE:
2380 list = curstyle->commentMatch;
2381 break;
2382 case XML_ENTITY_REF_NODE:
2383 case XML_ENTITY_NODE:
2384 case XML_DOCUMENT_TYPE_NODE:
2385 case XML_DOCUMENT_FRAG_NODE:
2386 case XML_NOTATION_NODE:
2387 case XML_DTD_NODE:
2388 case XML_ELEMENT_DECL:
2389 case XML_ATTRIBUTE_DECL:
2390 case XML_ENTITY_DECL:
2391 case XML_NAMESPACE_DECL:
2392 case XML_XINCLUDE_START:
2393 case XML_XINCLUDE_END:
2394 break;
2395 default:
2396 break;
2397 }
2398 while ((list != NULL) &&
2399 ((ret == NULL) ||
2400 (list->priority > priority) ||
2401 ((list->priority == priority) &&
2402 (list->template->position > ret->position)))) {
2403 if (xsltTestCompMatch(ctxt, list, node,
2404 ctxt->mode, ctxt->modeURI) == 1) {
2405 ret = list->template;
2406 priority = list->priority;
2407 break;
2408 }
2409 list = list->next;
2410 }
2411 /*
2412 * Some of the tests for elements can also apply to documents
2413 */
2414 if ((node->type == XML_DOCUMENT_NODE) ||
2415 (node->type == XML_HTML_DOCUMENT_NODE) ||
2416 (node->type == XML_TEXT_NODE)) {
2417 list = curstyle->elemMatch;
2418 while ((list != NULL) &&
2419 ((ret == NULL) ||
2420 (list->priority > priority) ||
2421 ((list->priority == priority) &&
2422 (list->template->position > ret->position)))) {
2423 if (xsltTestCompMatch(ctxt, list, node,
2424 ctxt->mode, ctxt->modeURI) == 1) {
2425 ret = list->template;
2426 priority = list->priority;
2427 break;
2428 }
2429 list = list->next;
2430 }
2431 } else if ((node->type == XML_PI_NODE) ||
2432 (node->type == XML_COMMENT_NODE)) {
2433 list = curstyle->elemMatch;
2434 while ((list != NULL) &&
2435 ((ret == NULL) ||
2436 (list->priority > priority) ||
2437 ((list->priority == priority) &&
2438 (list->template->position > ret->position)))) {
2439 if (xsltTestCompMatch(ctxt, list, node,
2440 ctxt->mode, ctxt->modeURI) == 1) {
2441 ret = list->template;
2442 priority = list->priority;
2443 break;
2444 }
2445 list = list->next;
2446 }
2447 }
2448
2449keyed_match:
2450 if (xsltGetSourceNodeFlags(node) & XSLT_SOURCE_NODE_HAS_KEY) {
2451 list = curstyle->keyMatch;
2452 while ((list != NULL) &&
2453 ((ret == NULL) ||
2454 (list->priority > priority) ||
2455 ((list->priority == priority) &&
2456 (list->template->position > ret->position)))) {
2457 if (xsltTestCompMatch(ctxt, list, node,
2458 ctxt->mode, ctxt->modeURI) == 1) {
2459 ret = list->template;
2460 priority = list->priority;
2461 break;
2462 }
2463 list = list->next;
2464 }
2465 }
2466 else if (ctxt->hasTemplKeyPatterns &&
2467 ((ctxt->document == NULL) ||
2468 (ctxt->document->nbKeysComputed < ctxt->nbKeys)))
2469 {
2470 /*
2471 * Compute all remaining keys for this document.
2472 *
2473 * REVISIT TODO: I think this could be further optimized.
2474 */
2475 if (xsltComputeAllKeys(ctxt, node) == -1)
2476 goto error;
2477
2478 if (xsltGetSourceNodeFlags(node) & XSLT_SOURCE_NODE_HAS_KEY)
2479 goto keyed_match;
2480 }
2481 if (ret != NULL)
2482 return(ret);
2483
2484 /*
2485 * Cycle on next curstylesheet import.
2486 */
2487 curstyle = xsltNextImport(curstyle);
2488 }
2489
2490error:
2491 return(NULL);
2492}
static int xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode)
Definition: pattern.c:2232
static int xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr matchNode, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:937
return ret
Definition: mutex.c:146
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:297
#define error(str)
Definition: mkdosfs.c:1605
struct _xsltCompMatch * rootMatch
struct _xsltCompMatch * textMatch
struct _xsltCompMatch * elemMatch
struct _xsltCompMatch * piMatch
xmlHashTablePtr templatesHash
struct _xsltCompMatch * attrMatch
struct _xsltCompMatch * commentMatch
struct _xsltCompMatch * keyMatch
const xmlChar * modeURI
xsltDocumentPtr document
xsltStylesheetPtr style
const xmlChar * mode
int xsltGetSourceNodeFlags(xmlNodePtr node)
Definition: xsltutils.c:1923

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 1132 of file pattern.c.

1133 {
1134 int ret;
1135
1136 if ((ctxt == NULL) || (node == NULL))
1137 return(-1);
1138 while (comp != NULL) {
1139 ret = xsltTestCompMatch(ctxt, comp, node, NULL, NULL);
1140 if (ret == 1)
1141 return(1);
1142 comp = comp->next;
1143 }
1144 return(0);
1145}

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