| OLD | NEW |
| 1 /* | 1 /* |
| 2 * preproc.c: Preprocessing of style operations | 2 * preproc.c: Preprocessing of style operations |
| 3 * | 3 * |
| 4 * References: | 4 * References: |
| 5 * http://www.w3.org/TR/1999/REC-xslt-19991116 | 5 * http://www.w3.org/TR/1999/REC-xslt-19991116 |
| 6 * | 6 * |
| 7 * Michael Kay "XSLT Programmer's Reference" pp 637-643 | 7 * Michael Kay "XSLT Programmer's Reference" pp 637-643 |
| 8 * Writing Multiple Output Files | 8 * Writing Multiple Output Files |
| 9 * | 9 * |
| 10 * XSLT-1.1 Working Draft | 10 * XSLT-1.1 Working Draft |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 * in effect for the xsl:element element, including any default | 942 * in effect for the xsl:element element, including any default |
| 943 * namespace declaration. | 943 * namespace declaration. |
| 944 */ | 944 */ |
| 945 ns = xmlSearchNs(inst->doc, inst, prefix); | 945 ns = xmlSearchNs(inst->doc, inst, prefix); |
| 946 if (ns != NULL) { | 946 if (ns != NULL) { |
| 947 comp->ns = xmlDictLookup(style->dict, ns->href, -1); | 947 comp->ns = xmlDictLookup(style->dict, ns->href, -1); |
| 948 comp->has_ns = 1; | 948 comp->has_ns = 1; |
| 949 #ifdef XSLT_REFACTORED | 949 #ifdef XSLT_REFACTORED |
| 950 comp->nsPrefix = prefix; | 950 comp->nsPrefix = prefix; |
| 951 comp->name = name; | 951 comp->name = name; |
| 952 #else |
| 953 (void)name; /* Suppress unused variable warning. */ |
| 952 #endif | 954 #endif |
| 953 } else if (prefix != NULL) { | 955 } else if (prefix != NULL) { |
| 954 xsltTransformError(NULL, style, inst, | 956 xsltTransformError(NULL, style, inst, |
| 955 "xsl:element: The prefixed QName '%s' " | 957 "xsl:element: The prefixed QName '%s' " |
| 956 "has no namespace binding in scope in the " | 958 "has no namespace binding in scope in the " |
| 957 "stylesheet; this is an error, since the namespace was " | 959 "stylesheet; this is an error, since the namespace was " |
| 958 "not specified by the instruction itself.\n", comp->name
); | 960 "not specified by the instruction itself.\n", comp->name
); |
| 959 style->errors++; | 961 style->errors++; |
| 960 } | 962 } |
| 961 } | 963 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 * namespace declarations in effect for the xsl:element | 1069 * namespace declarations in effect for the xsl:element |
| 1068 * element, including any default namespace declaration. | 1070 * element, including any default namespace declaration. |
| 1069 */ | 1071 */ |
| 1070 ns = xmlSearchNs(inst->doc, inst, prefix); | 1072 ns = xmlSearchNs(inst->doc, inst, prefix); |
| 1071 if (ns != NULL) { | 1073 if (ns != NULL) { |
| 1072 comp->ns = xmlDictLookup(style->dict, ns->href, -1); | 1074 comp->ns = xmlDictLookup(style->dict, ns->href, -1); |
| 1073 comp->has_ns = 1; | 1075 comp->has_ns = 1; |
| 1074 #ifdef XSLT_REFACTORED | 1076 #ifdef XSLT_REFACTORED |
| 1075 comp->nsPrefix = prefix; | 1077 comp->nsPrefix = prefix; |
| 1076 comp->name = name; | 1078 comp->name = name; |
| 1079 #else |
| 1080 (void)name; /* Suppress unused variable warning. */ |
| 1077 #endif | 1081 #endif |
| 1078 } else { | 1082 } else { |
| 1079 xsltTransformError(NULL, style, inst, | 1083 xsltTransformError(NULL, style, inst, |
| 1080 "xsl:attribute: The prefixed QName '%s' " | 1084 "xsl:attribute: The prefixed QName '%s' " |
| 1081 "has no namespace binding in scope in the " | 1085 "has no namespace binding in scope in the " |
| 1082 "stylesheet; this is an error, since the " | 1086 "stylesheet; this is an error, since the " |
| 1083 "namespace was not specified by the instruction " | 1087 "namespace was not specified by the instruction " |
| 1084 "itself.\n", comp->name); | 1088 "itself.\n", comp->name); |
| 1085 style->errors++; | 1089 style->errors++; |
| 1086 } | 1090 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 style->errors++; | 1298 style->errors++; |
| 1295 return; | 1299 return; |
| 1296 } else { | 1300 } else { |
| 1297 /* | 1301 /* |
| 1298 * @prop will be in the string dict afterwards, @URI not. | 1302 * @prop will be in the string dict afterwards, @URI not. |
| 1299 */ | 1303 */ |
| 1300 URI = xsltGetQNameURI2(style, inst, &prop); | 1304 URI = xsltGetQNameURI2(style, inst, &prop); |
| 1301 if (prop == NULL) { | 1305 if (prop == NULL) { |
| 1302 style->errors++; | 1306 style->errors++; |
| 1303 } else { | 1307 } else { |
| 1304 » » *localName = prop; | 1308 » » if (localName) |
| 1309 » » *localName = prop; |
| 1305 if (hasProp) | 1310 if (hasProp) |
| 1306 *hasProp = 1; | 1311 *hasProp = 1; |
| 1307 if (URI != NULL) { | 1312 if (URI != NULL) { |
| 1308 /* | 1313 /* |
| 1309 * Fixes bug #308441: Put the ns-name in the dict | 1314 * Fixes bug #308441: Put the ns-name in the dict |
| 1310 * in order to pointer compare names during XPath's | 1315 * in order to pointer compare names during XPath's |
| 1311 * variable lookup. | 1316 * variable lookup. |
| 1312 */ | 1317 */ |
| 1313 if (nsName) | 1318 if (nsName) |
| 1314 *nsName = xmlDictLookup(style->dict, URI, -1); | 1319 *nsName = xmlDictLookup(style->dict, URI, -1); |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 xsltChooseComp(style, inst); | 2243 xsltChooseComp(style, inst); |
| 2239 } else if (IS_XSLT_NAME(inst, "for-each")) { | 2244 } else if (IS_XSLT_NAME(inst, "for-each")) { |
| 2240 xsltCheckInstructionElement(style, inst); | 2245 xsltCheckInstructionElement(style, inst); |
| 2241 xsltForEachComp(style, inst); | 2246 xsltForEachComp(style, inst); |
| 2242 } else if (IS_XSLT_NAME(inst, "apply-imports")) { | 2247 } else if (IS_XSLT_NAME(inst, "apply-imports")) { |
| 2243 xsltCheckInstructionElement(style, inst); | 2248 xsltCheckInstructionElement(style, inst); |
| 2244 xsltApplyImportsComp(style, inst); | 2249 xsltApplyImportsComp(style, inst); |
| 2245 } else if (IS_XSLT_NAME(inst, "attribute")) { | 2250 } else if (IS_XSLT_NAME(inst, "attribute")) { |
| 2246 xmlNodePtr parent = inst->parent; | 2251 xmlNodePtr parent = inst->parent; |
| 2247 | 2252 |
| 2248 » if ((parent == NULL) || (parent->ns == NULL) || | 2253 » if ((parent == NULL) || |
| 2254 » (parent->type != XML_ELEMENT_NODE) || (parent->ns == NULL) || |
| 2249 ((parent->ns != inst->ns) && | 2255 ((parent->ns != inst->ns) && |
| 2250 (!xmlStrEqual(parent->ns->href, inst->ns->href))) || | 2256 (!xmlStrEqual(parent->ns->href, inst->ns->href))) || |
| 2251 (!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) { | 2257 (!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) { |
| 2252 xsltCheckInstructionElement(style, inst); | 2258 xsltCheckInstructionElement(style, inst); |
| 2253 } | 2259 } |
| 2254 xsltAttributeComp(style, inst); | 2260 xsltAttributeComp(style, inst); |
| 2255 } else if (IS_XSLT_NAME(inst, "element")) { | 2261 } else if (IS_XSLT_NAME(inst, "element")) { |
| 2256 xsltCheckInstructionElement(style, inst); | 2262 xsltCheckInstructionElement(style, inst); |
| 2257 xsltElementComp(style, inst); | 2263 xsltElementComp(style, inst); |
| 2258 } else if (IS_XSLT_NAME(inst, "text")) { | 2264 } else if (IS_XSLT_NAME(inst, "text")) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 | 2370 |
| 2365 /* | 2371 /* |
| 2366 * Unknown element, maybe registered at the context | 2372 * Unknown element, maybe registered at the context |
| 2367 * level. Mark it for later recognition. | 2373 * level. Mark it for later recognition. |
| 2368 */ | 2374 */ |
| 2369 if (inst->psvi == NULL) | 2375 if (inst->psvi == NULL) |
| 2370 inst->psvi = (void *) xsltExtMarker; | 2376 inst->psvi = (void *) xsltExtMarker; |
| 2371 } | 2377 } |
| 2372 } | 2378 } |
| 2373 #endif /* XSLT_REFACTORED */ | 2379 #endif /* XSLT_REFACTORED */ |
| OLD | NEW |