ReactOS 0.4.15-dev-7953-g1f49173
pattern.h File Reference
#include "xsltInternals.h"
#include "xsltexports.h"
Include dependency graph for pattern.h:

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

2017 {
2019 /*
2020 * 'top' will point to style->xxxMatch ptr - declaring as 'void'
2021 * avoids gcc 'type-punned pointer' warning.
2022 */
2024 const xmlChar *name = NULL;
2025 float priority; /* the priority */
2026
2027 if ((style == NULL) || (cur == NULL))
2028 return(-1);
2029
2030 if (cur->next != NULL)
2031 cur->position = cur->next->position + 1;
2032
2033 /* Register named template */
2034 if (cur->name != NULL) {
2035 if (style->namedTemplates == NULL) {
2036 style->namedTemplates = xmlHashCreate(10);
2037 if (style->namedTemplates == NULL)
2038 return(-1);
2039 }
2040 else {
2041 void *dup = xmlHashLookup2(style->namedTemplates, cur->name,
2042 cur->nameURI);
2043 if (dup != NULL) {
2045 "xsl:template: error duplicate name '%s'\n",
2046 cur->name);
2047 style->errors++;
2048 return(-1);
2049 }
2050 }
2051
2052 xmlHashAddEntry2(style->namedTemplates, cur->name, cur->nameURI, cur);
2053 }
2054
2055 if (cur->match == NULL) {
2056 if (cur->name == NULL) {
2058 "xsl:template: need to specify match or name attribute\n");
2059 style->errors++;
2060 return(-1);
2061 }
2062 return(0);
2063 }
2064
2065 priority = cur->priority;
2066 pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
2067 style, NULL, 1);
2068 if (pat == NULL)
2069 return(-1);
2070 while (pat) {
2071 next = pat->next;
2072 pat->next = NULL;
2073 name = NULL;
2074
2075 pat->template = cur;
2076 if (mode != NULL)
2077 pat->mode = xmlDictLookup(style->dict, mode, -1);
2078 if (modeURI != NULL)
2079 pat->modeURI = xmlDictLookup(style->dict, modeURI, -1);
2081 pat->priority = priority;
2082
2083 /*
2084 * insert it in the hash table list corresponding to its lookup name
2085 */
2086 switch (pat->steps[0].op) {
2087 case XSLT_OP_ATTR:
2088 if (pat->steps[0].value != NULL)
2089 name = pat->steps[0].value;
2090 else
2091 top = &(style->attrMatch);
2092 break;
2093 case XSLT_OP_PARENT:
2094 case XSLT_OP_ANCESTOR:
2095 top = &(style->elemMatch);
2096 break;
2097 case XSLT_OP_ROOT:
2098 top = &(style->rootMatch);
2099 break;
2100 case XSLT_OP_KEY:
2101 top = &(style->keyMatch);
2102 break;
2103 case XSLT_OP_ID:
2104 /* TODO optimize ID !!! */
2105 case XSLT_OP_NS:
2106 case XSLT_OP_ALL:
2107 top = &(style->elemMatch);
2108 break;
2109 case XSLT_OP_END:
2110 case XSLT_OP_PREDICATE:
2112 "xsltAddTemplate: invalid compiled pattern\n");
2113 xsltFreeCompMatch(pat);
2114 return(-1);
2115 /*
2116 * TODO: some flags at the top level about type based patterns
2117 * would be faster than inclusion in the hash table.
2118 */
2119 case XSLT_OP_PI:
2120 if (pat->steps[0].value != NULL)
2121 name = pat->steps[0].value;
2122 else
2123 top = &(style->piMatch);
2124 break;
2125 case XSLT_OP_COMMENT:
2126 top = &(style->commentMatch);
2127 break;
2128 case XSLT_OP_TEXT:
2129 top = &(style->textMatch);
2130 break;
2131 case XSLT_OP_ELEM:
2132 case XSLT_OP_NODE:
2133 if (pat->steps[0].value != NULL)
2134 name = pat->steps[0].value;
2135 else
2136 top = &(style->elemMatch);
2137 break;
2138 }
2139 if (name != NULL) {
2140 if (style->templatesHash == NULL) {
2141 style->templatesHash = xmlHashCreate(1024);
2142 if (style->templatesHash == NULL) {
2143 xsltFreeCompMatch(pat);
2144 return(-1);
2145 }
2146 xmlHashAddEntry3(style->templatesHash, name, mode, modeURI, pat);
2147 } else {
2148 list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash,
2149 name, mode, modeURI);
2150 if (list == NULL) {
2151 xmlHashAddEntry3(style->templatesHash, name,
2152 mode, modeURI, pat);
2153 } else {
2154 /*
2155 * Note '<=' since one must choose among the matching
2156 * template rules that are left, the one that occurs
2157 * last in the stylesheet
2158 */
2159 if (list->priority <= pat->priority) {
2160 pat->next = list;
2161 xmlHashUpdateEntry3(style->templatesHash, name,
2162 mode, modeURI, pat, NULL);
2163 } else {
2164 while (list->next != NULL) {
2165 if (list->next->priority <= pat->priority)
2166 break;
2167 list = list->next;
2168 }
2169 pat->next = list->next;
2170 list->next = pat;
2171 }
2172 }
2173 }
2174 } else if (top != NULL) {
2175 list = *top;
2176 if (list == NULL) {
2177 *top = pat;
2178 pat->next = NULL;
2179 } else if (list->priority <= pat->priority) {
2180 pat->next = list;
2181 *top = pat;
2182 } else {
2183 while (list->next != NULL) {
2184 if (list->next->priority <= pat->priority)
2185 break;
2186 list = list->next;
2187 }
2188 pat->next = list->next;
2189 list->next = pat;
2190 }
2191 } else {
2193 "xsltAddTemplate: invalid compiled pattern\n");
2194 xsltFreeCompMatch(pat);
2195 return(-1);
2196 }
2197#ifdef WITH_XSLT_DEBUG_PATTERN
2198 if (mode)
2200 "added pattern : '%s' mode '%s' priority %f\n",
2201 pat->pattern, pat->mode, pat->priority);
2202 else
2204 "added pattern : '%s' priority %f\n",
2205 pat->pattern, pat->priority);
2206#endif
2207
2208 pat = next;
2209 }
2210 return(0);
2211}
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:1816
static void xsltFreeCompMatch(xsltCompMatchPtr comp)
Definition: pattern.c:159
@ XSLT_OP_PREDICATE
Definition: pattern.c:42
@ XSLT_OP_PARENT
Definition: pattern.c:32
@ XSLT_OP_TEXT
Definition: pattern.c:40
@ XSLT_OP_END
Definition: pattern.c:28
@ XSLT_OP_ID
Definition: pattern.c:34
@ XSLT_OP_ALL
Definition: pattern.c:37
@ XSLT_OP_ELEM
Definition: pattern.c:30
@ XSLT_OP_NODE
Definition: pattern.c:41
@ XSLT_OP_ATTR
Definition: pattern.c:31
@ XSLT_OP_PI
Definition: pattern.c:38
@ XSLT_OP_COMMENT
Definition: pattern.c:39
@ XSLT_OP_KEY
Definition: pattern.c:35
@ XSLT_OP_ANCESTOR
Definition: pattern.c:33
@ XSLT_OP_ROOT
Definition: pattern.c:29
@ XSLT_OP_NS
Definition: pattern.c:36
FxCollectionEntry * cur
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum mode
Definition: glext.h:6217
#define dup
Definition: syshdrs.h:51
xsltCompMatch * xsltCompMatchPtr
Definition: pattern.h:29
static int priority
Definition: timer.c:163
static unsigned __int64 next
Definition: rand_nt.c:6
#define list
Definition: rosglue.h:35
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:867
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:406
XMLPUBFUN void *XMLCALL xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3)
Definition: hash.c:769
XMLPUBFUN int XMLCALL xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata, xmlHashDeallocator f)
Definition: hash.c:647
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:176
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:476
XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata)
Definition: hash.c:531
const xmlChar * pattern
Definition: pattern.c:84
struct _xsltCompMatch * next
Definition: pattern.c:82
xsltTemplatePtr template
Definition: pattern.c:87
xsltStepOpPtr steps
Definition: pattern.c:96
const xmlChar * mode
Definition: pattern.c:85
float priority
Definition: pattern.c:83
const xmlChar * modeURI
Definition: pattern.c:86
xmlChar * value
Definition: pattern.c:69
xsltOp op
Definition: pattern.c:68
Definition: name.c:39
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:678
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
void * xsltGenericDebugContext
Definition: xsltutils.c:549

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

2517 {
2518}

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

1994 {
1995 return (xsltCompilePatternInternal(pattern, doc, node, style, runtime, 0));
1996}
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 1144 of file pattern.c.

1144 {
1145 xsltStepOpPtr sel;
1146 xmlXPathObjectPtr list;
1147
1148 if ((ctxt == NULL) || (comp == NULL))
1149 return;
1150
1151 sel = &comp->steps[0];
1152 list = (xmlXPathObjectPtr) XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
1153
1154 if (list != NULL) {
1155 xmlXPathFreeObject(list);
1156
1157 XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) = NULL;
1159 XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = 0;
1161 }
1162}
static PVOID ptr
Definition: dispmode.c:27
int indexExtra
Definition: pattern.c:77
int lenExtra
Definition: pattern.c:78
int previousExtra
Definition: pattern.c:76
#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 192 of file pattern.c.

192 {
194
195 while (comp != NULL) {
196 cur = comp;
197 comp = comp->next;
199 }
200}

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

2527 {
2528 if (style->templatesHash != NULL)
2530 if (style->rootMatch != NULL)
2531 xsltFreeCompMatchList(style->rootMatch);
2532 if (style->keyMatch != NULL)
2533 xsltFreeCompMatchList(style->keyMatch);
2534 if (style->elemMatch != NULL)
2535 xsltFreeCompMatchList(style->elemMatch);
2536 if (style->attrMatch != NULL)
2537 xsltFreeCompMatchList(style->attrMatch);
2538 if (style->parentMatch != NULL)
2539 xsltFreeCompMatchList(style->parentMatch);
2540 if (style->textMatch != NULL)
2541 xsltFreeCompMatchList(style->textMatch);
2542 if (style->piMatch != NULL)
2543 xsltFreeCompMatchList(style->piMatch);
2544 if (style->commentMatch != NULL)
2545 xsltFreeCompMatchList(style->commentMatch);
2546 if (style->namedTemplates != NULL)
2547 xmlHashFree(style->namedTemplates, NULL);
2548}
static void xsltFreeCompMatchListEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: pattern.c:203
void xsltFreeCompMatchList(xsltCompMatchPtr comp)
Definition: pattern.c:192
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:322

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

2261{
2262 xsltStylesheetPtr curstyle;
2264 const xmlChar *name = NULL;
2266 float priority;
2267 int keyed = 0;
2268
2269 if ((ctxt == NULL) || (node == NULL))
2270 return(NULL);
2271
2272 if (style == NULL) {
2273 curstyle = ctxt->style;
2274 } else {
2275 curstyle = xsltNextImport(style);
2276 }
2277
2278 while ((curstyle != NULL) && (curstyle != style)) {
2280 /* TODO : handle IDs/keys here ! */
2281 if (curstyle->templatesHash != NULL) {
2282 /*
2283 * Use the top name as selector
2284 */
2285 switch (node->type) {
2286 case XML_ELEMENT_NODE:
2287 if (node->name[0] == ' ')
2288 break;
2289 /* Intentional fall-through */
2290 case XML_ATTRIBUTE_NODE:
2291 case XML_PI_NODE:
2292 name = node->name;
2293 break;
2294 case XML_DOCUMENT_NODE:
2296 case XML_TEXT_NODE:
2298 case XML_COMMENT_NODE:
2300 case XML_ENTITY_NODE:
2303 case XML_NOTATION_NODE:
2304 case XML_DTD_NODE:
2305 case XML_ELEMENT_DECL:
2306 case XML_ATTRIBUTE_DECL:
2307 case XML_ENTITY_DECL:
2308 case XML_NAMESPACE_DECL:
2309 case XML_XINCLUDE_START:
2310 case XML_XINCLUDE_END:
2311 break;
2312 default:
2313 return(NULL);
2314
2315 }
2316 }
2317 if (name != NULL) {
2318 /*
2319 * find the list of applicable expressions based on the name
2320 */
2322 name, ctxt->mode, ctxt->modeURI);
2323 } else
2324 list = NULL;
2325 while (list != NULL) {
2326 if (xsltTestCompMatch(ctxt, list, node,
2327 ctxt->mode, ctxt->modeURI) == 1) {
2328 ret = list->template;
2329 priority = list->priority;
2330 break;
2331 }
2332 list = list->next;
2333 }
2334 list = NULL;
2335
2336 /*
2337 * find alternate generic matches
2338 */
2339 switch (node->type) {
2340 case XML_ELEMENT_NODE:
2341 if (node->name[0] == ' ')
2342 list = curstyle->rootMatch;
2343 else
2344 list = curstyle->elemMatch;
2345 if (node->psvi != NULL) keyed = 1;
2346 break;
2347 case XML_ATTRIBUTE_NODE: {
2349
2350 list = curstyle->attrMatch;
2351 attr = (xmlAttrPtr) node;
2352 if (attr->psvi != NULL) keyed = 1;
2353 break;
2354 }
2355 case XML_PI_NODE:
2356 list = curstyle->piMatch;
2357 if (node->psvi != NULL) keyed = 1;
2358 break;
2359 case XML_DOCUMENT_NODE:
2361 xmlDocPtr doc;
2362
2363 list = curstyle->rootMatch;
2364 doc = (xmlDocPtr) node;
2365 if (doc->psvi != NULL) keyed = 1;
2366 break;
2367 }
2368 case XML_TEXT_NODE:
2370 list = curstyle->textMatch;
2371 if (node->psvi != NULL) keyed = 1;
2372 break;
2373 case XML_COMMENT_NODE:
2374 list = curstyle->commentMatch;
2375 if (node->psvi != NULL) keyed = 1;
2376 break;
2378 case XML_ENTITY_NODE:
2381 case XML_NOTATION_NODE:
2382 case XML_DTD_NODE:
2383 case XML_ELEMENT_DECL:
2384 case XML_ATTRIBUTE_DECL:
2385 case XML_ENTITY_DECL:
2386 case XML_NAMESPACE_DECL:
2387 case XML_XINCLUDE_START:
2388 case XML_XINCLUDE_END:
2389 break;
2390 default:
2391 break;
2392 }
2393 while ((list != NULL) &&
2394 ((ret == NULL) ||
2395 (list->priority > priority) ||
2396 ((list->priority == priority) &&
2397 (list->template->position > ret->position)))) {
2398 if (xsltTestCompMatch(ctxt, list, node,
2399 ctxt->mode, ctxt->modeURI) == 1) {
2400 ret = list->template;
2401 priority = list->priority;
2402 break;
2403 }
2404 list = list->next;
2405 }
2406 /*
2407 * Some of the tests for elements can also apply to documents
2408 */
2409 if ((node->type == XML_DOCUMENT_NODE) ||
2410 (node->type == XML_HTML_DOCUMENT_NODE) ||
2411 (node->type == XML_TEXT_NODE)) {
2412 list = curstyle->elemMatch;
2413 while ((list != NULL) &&
2414 ((ret == NULL) ||
2415 (list->priority > priority) ||
2416 ((list->priority == priority) &&
2417 (list->template->position > ret->position)))) {
2418 if (xsltTestCompMatch(ctxt, list, node,
2419 ctxt->mode, ctxt->modeURI) == 1) {
2420 ret = list->template;
2421 priority = list->priority;
2422 break;
2423 }
2424 list = list->next;
2425 }
2426 } else if ((node->type == XML_PI_NODE) ||
2427 (node->type == XML_COMMENT_NODE)) {
2428 list = curstyle->elemMatch;
2429 while ((list != NULL) &&
2430 ((ret == NULL) ||
2431 (list->priority > priority) ||
2432 ((list->priority == priority) &&
2433 (list->template->position > ret->position)))) {
2434 if (xsltTestCompMatch(ctxt, list, node,
2435 ctxt->mode, ctxt->modeURI) == 1) {
2436 ret = list->template;
2437 priority = list->priority;
2438 break;
2439 }
2440 list = list->next;
2441 }
2442 }
2443
2444keyed_match:
2445 if (keyed) {
2446 list = curstyle->keyMatch;
2447 while ((list != NULL) &&
2448 ((ret == NULL) ||
2449 (list->priority > priority) ||
2450 ((list->priority == priority) &&
2451 (list->template->position > ret->position)))) {
2452 if (xsltTestCompMatch(ctxt, list, node,
2453 ctxt->mode, ctxt->modeURI) == 1) {
2454 ret = list->template;
2455 priority = list->priority;
2456 break;
2457 }
2458 list = list->next;
2459 }
2460 }
2461 else if (ctxt->hasTemplKeyPatterns &&
2462 ((ctxt->document == NULL) ||
2463 (ctxt->document->nbKeysComputed < ctxt->nbKeys)))
2464 {
2465 /*
2466 * Compute all remaining keys for this document.
2467 *
2468 * REVISIT TODO: I think this could be further optimized.
2469 */
2470 if (xsltComputeAllKeys(ctxt, node) == -1)
2471 goto error;
2472
2473 switch (node->type) {
2474 case XML_ELEMENT_NODE:
2475 if (node->psvi != NULL) keyed = 1;
2476 break;
2477 case XML_ATTRIBUTE_NODE:
2478 if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1;
2479 break;
2480 case XML_TEXT_NODE:
2482 case XML_COMMENT_NODE:
2483 case XML_PI_NODE:
2484 if (node->psvi != NULL) keyed = 1;
2485 break;
2486 case XML_DOCUMENT_NODE:
2488 if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
2489 break;
2490 default:
2491 break;
2492 }
2493 if (keyed)
2494 goto keyed_match;
2495 }
2496 if (ret != NULL)
2497 return(ret);
2498
2499 /*
2500 * Cycle on next curstylesheet import.
2501 */
2502 curstyle = xsltNextImport(curstyle);
2503 }
2504
2505error:
2506 return(NULL);
2507}
static int xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode)
Definition: pattern.c:2214
static int xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr matchNode, const xmlChar *mode, const xmlChar *modeURI)
Definition: pattern.c:926
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:251
#define error(str)
Definition: mkdosfs.c:1605
xmlDoc * xmlDocPtr
Definition: tree.h:550
@ XML_DOCUMENT_TYPE_NODE
Definition: tree.h:169
@ XML_ATTRIBUTE_NODE
Definition: tree.h:161
@ XML_ENTITY_DECL
Definition: tree.h:176
@ XML_DOCUMENT_NODE
Definition: tree.h:168
@ XML_CDATA_SECTION_NODE
Definition: tree.h:163
@ XML_TEXT_NODE
Definition: tree.h:162
@ XML_XINCLUDE_START
Definition: tree.h:178
@ XML_ENTITY_NODE
Definition: tree.h:165
@ XML_PI_NODE
Definition: tree.h:166
@ XML_XINCLUDE_END
Definition: tree.h:179
@ XML_DOCUMENT_FRAG_NODE
Definition: tree.h:170
@ XML_COMMENT_NODE
Definition: tree.h:167
@ XML_DTD_NODE
Definition: tree.h:173
@ XML_NAMESPACE_DECL
Definition: tree.h:177
@ XML_HTML_DOCUMENT_NODE
Definition: tree.h:172
@ XML_ELEMENT_NODE
Definition: tree.h:160
@ XML_ELEMENT_DECL
Definition: tree.h:174
@ XML_ENTITY_REF_NODE
Definition: tree.h:164
@ XML_NOTATION_NODE
Definition: tree.h:171
@ XML_ATTRIBUTE_DECL
Definition: tree.h:175
xmlAttr * xmlAttrPtr
Definition: tree.h:433
Definition: tree.h:434
Definition: tree.h:551
void * psvi
Definition: tree.h:581
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
Definition: cookie.c:202
int ret

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

1122 {
1123 int ret;
1124
1125 if ((ctxt == NULL) || (node == NULL))
1126 return(-1);
1127 while (comp != NULL) {
1128 ret = xsltTestCompMatch(ctxt, comp, node, NULL, NULL);
1129 if (ret == 1)
1130 return(1);
1131 comp = comp->next;
1132 }
1133 return(0);
1134}

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