Index: third_party/libxslt/libxslt/xslt.c |
diff --git a/third_party/libxslt/libxslt/xslt.c b/third_party/libxslt/libxslt/xslt.c |
index bca91ee76606eba19412da5e118080ff774f77d0..d41a98de30b66017f080c502103cdaa9a4ab69b2 100644 |
--- a/third_party/libxslt/libxslt/xslt.c |
+++ b/third_party/libxslt/libxslt/xslt.c |
@@ -810,9 +810,8 @@ xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt) |
ctxt->extras = (xsltRuntimeExtraPtr) |
xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra)); |
if (ctxt->extras == NULL) { |
- xmlGenericError(xmlGenericErrorContext, |
+ xsltTransformError(ctxt, NULL, NULL, |
"xsltAllocateExtraCtxt: out of memory\n"); |
- ctxt->state = XSLT_STATE_ERROR; |
return(0); |
} |
for (i = 0;i < ctxt->extrasMax;i++) { |
@@ -828,9 +827,8 @@ xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt) |
tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras, |
ctxt->extrasMax * sizeof(xsltRuntimeExtra)); |
if (tmp == NULL) { |
- xmlGenericError(xmlGenericErrorContext, |
+ xsltTransformError(ctxt, NULL, NULL, |
"xsltAllocateExtraCtxt: out of memory\n"); |
- ctxt->state = XSLT_STATE_ERROR; |
return(0); |
} |
ctxt->extras = tmp; |
@@ -3424,7 +3422,7 @@ internal_err: |
#ifdef XSLT_REFACTORED |
#else |
static void |
-xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) |
+xsltPreprocessStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) |
{ |
xmlNodePtr deleteNode, styleelem; |
int internalize = 0; |
@@ -3455,7 +3453,7 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) |
if (deleteNode != NULL) { |
#ifdef WITH_XSLT_DEBUG_BLANKS |
xsltGenericDebug(xsltGenericDebugContext, |
- "xsltPrecomputeStylesheet: removing ignorable blank node\n"); |
+ "xsltPreprocessStylesheet: removing ignorable blank node\n"); |
#endif |
xmlUnlinkNode(deleteNode); |
xmlFreeNode(deleteNode); |
@@ -3495,7 +3493,6 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) |
} |
if (IS_XSLT_ELEM(cur)) { |
exclPrefixes = 0; |
- xsltStylePreCompute(style, cur); |
if (IS_XSLT_NAME(cur, "text")) { |
for (;exclPrefixes > 0;exclPrefixes--) |
exclPrefixPop(style); |
@@ -3546,7 +3543,7 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) |
* going back |
*/ |
if (exclPrefixes > 0) { |
- xsltPrecomputeStylesheet(style, cur->children); |
+ xsltPreprocessStylesheet(style, cur->children); |
for (;exclPrefixes > 0;exclPrefixes--) |
exclPrefixPop(style); |
goto skip_children; |
@@ -3617,7 +3614,7 @@ skip_children: |
if (deleteNode != NULL) { |
#ifdef WITH_XSLT_DEBUG_PARSING |
xsltGenericDebug(xsltGenericDebugContext, |
- "xsltPrecomputeStylesheet: removing ignorable blank node\n"); |
+ "xsltPreprocessStylesheet: removing ignorable blank node\n"); |
#endif |
xmlUnlinkNode(deleteNode); |
xmlFreeNode(deleteNode); |
@@ -4862,10 +4859,12 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { |
delete = NULL; |
} |
if (IS_XSLT_ELEM(cur)) { |
+ xsltStylePreCompute(style, cur); |
+ |
if (IS_XSLT_NAME(cur, "text")) { |
/* |
* TODO: Processing of xsl:text should be moved to |
- * xsltPrecomputeStylesheet(), since otherwise this |
+ * xsltPreprocessStylesheet(), since otherwise this |
* will be performed for every multiply included |
* stylesheet; i.e. this here is not skipped with |
* the use of the style->nopreproc flag. |
@@ -6054,7 +6053,7 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { |
if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) && |
(!xmlStrEqual(prop, (const xmlChar *)"1.1"))) { |
xsltTransformError(NULL, style, top, |
- "xsl:version: only 1.0 features are supported\n"); |
+ "xsl:version: only 1.1 features are supported\n"); |
if (style != NULL) { |
style->forwards_compatible = 1; |
style->warnings++; |
@@ -6125,31 +6124,31 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { |
xsltTransformError(NULL, style, cur, |
"xsltParseStylesheetTop: ignoring misplaced import element\n"); |
if (style != NULL) style->errors++; |
- } else if (IS_XSLT_NAME(cur, "include")) { |
+ } else if (IS_XSLT_NAME(cur, "include")) { |
if (xsltParseStylesheetInclude(style, cur) != 0) |
if (style != NULL) style->errors++; |
- } else if (IS_XSLT_NAME(cur, "strip-space")) { |
+ } else if (IS_XSLT_NAME(cur, "strip-space")) { |
xsltParseStylesheetStripSpace(style, cur); |
- } else if (IS_XSLT_NAME(cur, "preserve-space")) { |
+ } else if (IS_XSLT_NAME(cur, "preserve-space")) { |
xsltParseStylesheetPreserveSpace(style, cur); |
- } else if (IS_XSLT_NAME(cur, "output")) { |
+ } else if (IS_XSLT_NAME(cur, "output")) { |
xsltParseStylesheetOutput(style, cur); |
- } else if (IS_XSLT_NAME(cur, "key")) { |
+ } else if (IS_XSLT_NAME(cur, "key")) { |
xsltParseStylesheetKey(style, cur); |
- } else if (IS_XSLT_NAME(cur, "decimal-format")) { |
+ } else if (IS_XSLT_NAME(cur, "decimal-format")) { |
xsltParseStylesheetDecimalFormat(style, cur); |
- } else if (IS_XSLT_NAME(cur, "attribute-set")) { |
+ } else if (IS_XSLT_NAME(cur, "attribute-set")) { |
xsltParseStylesheetAttributeSet(style, cur); |
- } else if (IS_XSLT_NAME(cur, "variable")) { |
+ } else if (IS_XSLT_NAME(cur, "variable")) { |
xsltParseGlobalVariable(style, cur); |
- } else if (IS_XSLT_NAME(cur, "param")) { |
+ } else if (IS_XSLT_NAME(cur, "param")) { |
xsltParseGlobalParam(style, cur); |
- } else if (IS_XSLT_NAME(cur, "template")) { |
+ } else if (IS_XSLT_NAME(cur, "template")) { |
#ifdef WITH_XSLT_DEBUG_PARSING |
templates++; |
#endif |
xsltParseStylesheetTemplate(style, cur); |
- } else if (IS_XSLT_NAME(cur, "namespace-alias")) { |
+ } else if (IS_XSLT_NAME(cur, "namespace-alias")) { |
xsltNamespaceAlias(style, cur); |
} else { |
if ((style != NULL) && (style->forwards_compatible == 0)) { |
@@ -6158,13 +6157,6 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { |
cur->name); |
if (style != NULL) style->errors++; |
} |
- else { |
- /* do Forwards-Compatible Processing */ |
- xsltTransformError(NULL, style, cur, |
- "xsltParseStylesheetTop: ignoring unknown %s element\n", |
- cur->name); |
- if (style != NULL) style->warnings++; |
- } |
} |
cur = cur->next; |
} |
@@ -6408,7 +6400,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { |
ret->literal_result = 1; |
} |
if (!ret->nopreproc) { |
- xsltPrecomputeStylesheet(ret, cur); |
+ xsltPreprocessStylesheet(ret, cur); |
} |
if (ret->literal_result == 0) { |
xsltParseStylesheetTop(ret, cur); |
@@ -6431,10 +6423,11 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { |
"xsltParseStylesheetProcess : document is stylesheet\n"); |
#endif |
- if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) { |
+ if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) && |
+ (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) { |
xsltTransformError(NULL, ret, cur, |
- "xsl:version: only 1.0 features are supported\n"); |
- /* TODO set up compatibility when not XSLT 1.0 */ |
+ "xsl:version: only 1.1 features are supported\n"); |
+ ret->forwards_compatible = 1; |
ret->warnings++; |
} |
xmlFree(prop); |