xslt: Import upstream release 1.1.37.
This commit is contained in:
parent
d0b03aa202
commit
162acdaed0
5 changed files with 32 additions and 22 deletions
|
@ -608,7 +608,8 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
||||||
|
|
||||||
switch (nargs) {
|
switch (nargs) {
|
||||||
case 3:
|
case 3:
|
||||||
CAST_TO_STRING;
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING))
|
||||||
|
xmlXPathStringFunction(ctxt, 1);
|
||||||
decimalObj = valuePop(ctxt);
|
decimalObj = valuePop(ctxt);
|
||||||
ncname = xsltSplitQName(sheet->dict, decimalObj->stringval, &prefix);
|
ncname = xsltSplitQName(sheet->dict, decimalObj->stringval, &prefix);
|
||||||
if (prefix != NULL) {
|
if (prefix != NULL) {
|
||||||
|
@ -634,13 +635,16 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
||||||
}
|
}
|
||||||
/* Intentional fall-through */
|
/* Intentional fall-through */
|
||||||
case 2:
|
case 2:
|
||||||
CAST_TO_STRING;
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING))
|
||||||
|
xmlXPathStringFunction(ctxt, 1);
|
||||||
formatObj = valuePop(ctxt);
|
formatObj = valuePop(ctxt);
|
||||||
CAST_TO_NUMBER;
|
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER))
|
||||||
|
xmlXPathNumberFunction(ctxt, 1);
|
||||||
numberObj = valuePop(ctxt);
|
numberObj = valuePop(ctxt);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
XP_ERROR(XPATH_INVALID_ARITY);
|
xmlXPathErr(ctxt, XPATH_INVALID_ARITY);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatValues != NULL) {
|
if (formatValues != NULL) {
|
||||||
|
|
|
@ -310,7 +310,7 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
|
||||||
current = end = 0;
|
current = end = 0;
|
||||||
while (match[current] != 0) {
|
while (match[current] != 0) {
|
||||||
start = current;
|
start = current;
|
||||||
while (IS_BLANK_CH(match[current]))
|
while (xmlIsBlank_ch(match[current]))
|
||||||
current++;
|
current++;
|
||||||
end = current;
|
end = current;
|
||||||
while ((match[end] != 0) && (match[end] != '|')) {
|
while ((match[end] != 0) && (match[end] != '|')) {
|
||||||
|
|
|
@ -92,6 +92,12 @@ xsltUTF8Charcmp(xmlChar *utf1, xmlChar *utf2) {
|
||||||
return xmlStrncmp(utf1, utf2, len);
|
return xmlStrncmp(utf1, utf2, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
xsltIsLetterDigit(int val) {
|
||||||
|
return xmlIsBaseCharQ(val) || xmlIsIdeographicQ(val) ||
|
||||||
|
xmlIsDigitQ(val);
|
||||||
|
}
|
||||||
|
|
||||||
/***** Stop temp insert *****/
|
/***** Stop temp insert *****/
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -347,8 +353,8 @@ xsltNumberFormatTokenize(const xmlChar *format,
|
||||||
* Insert initial non-alphanumeric token.
|
* Insert initial non-alphanumeric token.
|
||||||
* There is always such a token in the list, even if NULL
|
* There is always such a token in the list, even if NULL
|
||||||
*/
|
*/
|
||||||
while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) ||
|
while (!xsltIsLetterDigit(val = xmlStringCurrentChar(NULL, format+ix,
|
||||||
IS_DIGIT(val)) ) {
|
&len))) {
|
||||||
if (format[ix] == 0) /* if end of format string */
|
if (format[ix] == 0) /* if end of format string */
|
||||||
break; /* while */
|
break; /* while */
|
||||||
ix += len;
|
ix += len;
|
||||||
|
@ -414,7 +420,7 @@ xsltNumberFormatTokenize(const xmlChar *format,
|
||||||
* to correspond to the Letter and Digit classes from XML (and
|
* to correspond to the Letter and Digit classes from XML (and
|
||||||
* one wonders why XSLT doesn't refer to these instead).
|
* one wonders why XSLT doesn't refer to these instead).
|
||||||
*/
|
*/
|
||||||
while (IS_LETTER(val) || IS_DIGIT(val)) {
|
while (xsltIsLetterDigit(val)) {
|
||||||
ix += len;
|
ix += len;
|
||||||
val = xmlStringCurrentChar(NULL, format+ix, &len);
|
val = xmlStringCurrentChar(NULL, format+ix, &len);
|
||||||
}
|
}
|
||||||
|
@ -423,7 +429,7 @@ xsltNumberFormatTokenize(const xmlChar *format,
|
||||||
* Insert temporary non-alphanumeric final tooken.
|
* Insert temporary non-alphanumeric final tooken.
|
||||||
*/
|
*/
|
||||||
j = ix;
|
j = ix;
|
||||||
while (! (IS_LETTER(val) || IS_DIGIT(val))) {
|
while (!xsltIsLetterDigit(val)) {
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
break; /* while */
|
break; /* while */
|
||||||
ix += len;
|
ix += len;
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ xsltCompMatchClearCache(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp) {
|
||||||
#define CUR_PTR ctxt->cur
|
#define CUR_PTR ctxt->cur
|
||||||
|
|
||||||
#define SKIP_BLANKS \
|
#define SKIP_BLANKS \
|
||||||
while (IS_BLANK_CH(CUR)) NEXT
|
while (xmlIsBlank_ch(CUR)) NEXT
|
||||||
|
|
||||||
#define CURRENT (*ctxt->cur)
|
#define CURRENT (*ctxt->cur)
|
||||||
#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
|
#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
|
||||||
|
@ -1235,11 +1235,11 @@ xsltScanLiteral(xsltParserContextPtr ctxt) {
|
||||||
NEXT;
|
NEXT;
|
||||||
cur = q = CUR_PTR;
|
cur = q = CUR_PTR;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
while ((IS_CHAR(val)) && (val != '"')) {
|
while ((xmlIsCharQ(val)) && (val != '"')) {
|
||||||
cur += len;
|
cur += len;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
}
|
}
|
||||||
if (!IS_CHAR(val)) {
|
if (!xmlIsCharQ(val)) {
|
||||||
ctxt->error = 1;
|
ctxt->error = 1;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1251,11 +1251,11 @@ xsltScanLiteral(xsltParserContextPtr ctxt) {
|
||||||
NEXT;
|
NEXT;
|
||||||
cur = q = CUR_PTR;
|
cur = q = CUR_PTR;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
while ((IS_CHAR(val)) && (val != '\'')) {
|
while ((xmlIsCharQ(val)) && (val != '\'')) {
|
||||||
cur += len;
|
cur += len;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
}
|
}
|
||||||
if (!IS_CHAR(val)) {
|
if (!xmlIsCharQ(val)) {
|
||||||
ctxt->error = 1;
|
ctxt->error = 1;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1264,7 +1264,6 @@ xsltScanLiteral(xsltParserContextPtr ctxt) {
|
||||||
cur += len;
|
cur += len;
|
||||||
CUR_PTR = cur;
|
CUR_PTR = cur;
|
||||||
} else {
|
} else {
|
||||||
/* XP_ERROR(XPATH_START_LITERAL_ERROR); */
|
|
||||||
ctxt->error = 1;
|
ctxt->error = 1;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1290,14 +1289,15 @@ xsltScanNCName(xsltParserContextPtr ctxt) {
|
||||||
|
|
||||||
cur = q = CUR_PTR;
|
cur = q = CUR_PTR;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
if (!IS_LETTER(val) && (val != '_'))
|
if (!xmlIsBaseCharQ(val) && !xmlIsIdeographicQ(val) && (val != '_'))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
while ((IS_LETTER(val)) || (IS_DIGIT(val)) ||
|
while (xmlIsBaseCharQ(val) || xmlIsIdeographicQ(val) ||
|
||||||
|
xmlIsDigitQ(val) ||
|
||||||
(val == '.') || (val == '-') ||
|
(val == '.') || (val == '-') ||
|
||||||
(val == '_') ||
|
(val == '_') ||
|
||||||
(IS_COMBINING(val)) ||
|
xmlIsCombiningQ(val) ||
|
||||||
(IS_EXTENDER(val))) {
|
xmlIsExtenderQ(val)) {
|
||||||
cur += len;
|
cur += len;
|
||||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||||
}
|
}
|
||||||
|
@ -1853,7 +1853,7 @@ xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc,
|
||||||
current = end = 0;
|
current = end = 0;
|
||||||
while (pattern[current] != 0) {
|
while (pattern[current] != 0) {
|
||||||
start = current;
|
start = current;
|
||||||
while (IS_BLANK_CH(pattern[current]))
|
while (xmlIsBlank_ch(pattern[current]))
|
||||||
current++;
|
current++;
|
||||||
end = current;
|
end = current;
|
||||||
level = 0;
|
level = 0;
|
||||||
|
|
|
@ -3637,12 +3637,12 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||||
|
|
||||||
element = elements;
|
element = elements;
|
||||||
while (*element != 0) {
|
while (*element != 0) {
|
||||||
while (IS_BLANK_CH(*element))
|
while (xmlIsBlank_ch(*element))
|
||||||
element++;
|
element++;
|
||||||
if (*element == 0)
|
if (*element == 0)
|
||||||
break;
|
break;
|
||||||
end = element;
|
end = element;
|
||||||
while ((*end != 0) && (!IS_BLANK_CH(*end)))
|
while ((*end != 0) && (!xmlIsBlank_ch(*end)))
|
||||||
end++;
|
end++;
|
||||||
element = xmlStrndup(element, end - element);
|
element = xmlStrndup(element, end - element);
|
||||||
if (element) {
|
if (element) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue