mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-31 02:43:06 +03:00
Big space and tabs cleanup
Remove spaces followed by tabs, and space and tabs at the end of lines
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* xsltICUSort.c: module provided by Richard Jinks to provide a
|
* xsltICUSort.c: module provided by Richard Jinks to provide a
|
||||||
* sort function replacement using ICU, it is not
|
* sort function replacement using ICU, it is not
|
||||||
* included in standard due to the size of the ICU
|
* included in standard due to the size of the ICU
|
||||||
* library
|
* library
|
||||||
@ -136,8 +136,8 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
conv = ucnv_open("UTF8", &status);
|
conv = ucnv_open("UTF8", &status);
|
||||||
if(U_FAILURE(status)) {
|
if(U_FAILURE(status)) {
|
||||||
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening converter\n");
|
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening converter\n");
|
||||||
}
|
}
|
||||||
if(comp->has_lang)
|
if(comp->has_lang)
|
||||||
coll = ucol_open(comp->lang, &status);
|
coll = ucol_open(comp->lang, &status);
|
||||||
if(U_FAILURE(status) || !comp->has_lang) {
|
if(U_FAILURE(status) || !comp->has_lang) {
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
@ -146,9 +146,9 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
if(U_FAILURE(status)) {
|
if(U_FAILURE(status)) {
|
||||||
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening collator\n");
|
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening collator\n");
|
||||||
}
|
}
|
||||||
if(comp->lower_first)
|
if(comp->lower_first)
|
||||||
ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_LOWER_FIRST,&status);
|
ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_LOWER_FIRST,&status);
|
||||||
else
|
else
|
||||||
ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_UPPER_FIRST,&status);
|
ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_UPPER_FIRST,&status);
|
||||||
if(U_FAILURE(status)) {
|
if(U_FAILURE(status)) {
|
||||||
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error setting collator attribute\n");
|
xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error setting collator attribute\n");
|
||||||
@ -161,7 +161,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
j = i - incr;
|
j = i - incr;
|
||||||
if (results[i] == NULL)
|
if (results[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
while (j >= 0) {
|
while (j >= 0) {
|
||||||
if (results[j] == NULL)
|
if (results[j] == NULL)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
@ -169,7 +169,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
if (number) {
|
if (number) {
|
||||||
if (results[j]->floatval == results[j + incr]->floatval)
|
if (results[j]->floatval == results[j + incr]->floatval)
|
||||||
tst = 0;
|
tst = 0;
|
||||||
else if (results[j]->floatval >
|
else if (results[j]->floatval >
|
||||||
results[j + incr]->floatval)
|
results[j + incr]->floatval)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
else tst = -1;
|
else tst = -1;
|
||||||
@ -207,11 +207,11 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
* Compute the result of the next level for the
|
* Compute the result of the next level for the
|
||||||
* full set, this might be optimized ... or not
|
* full set, this might be optimized ... or not
|
||||||
*/
|
*/
|
||||||
if (resultsTab[depth] == NULL)
|
if (resultsTab[depth] == NULL)
|
||||||
resultsTab[depth] = xsltComputeSortResult(ctxt,
|
resultsTab[depth] = xsltComputeSortResult(ctxt,
|
||||||
sorts[depth]);
|
sorts[depth]);
|
||||||
res = resultsTab[depth];
|
res = resultsTab[depth];
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
break;
|
break;
|
||||||
if (res[j] == NULL)
|
if (res[j] == NULL)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
@ -219,7 +219,7 @@ xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
if (numb) {
|
if (numb) {
|
||||||
if (res[j]->floatval == res[j + incr]->floatval)
|
if (res[j]->floatval == res[j + incr]->floatval)
|
||||||
tst = 0;
|
tst = 0;
|
||||||
else if (res[j]->floatval >
|
else if (res[j]->floatval >
|
||||||
res[j + incr]->floatval)
|
res[j + incr]->floatval)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
else tst = -1;
|
else tst = -1;
|
||||||
|
@ -46,16 +46,16 @@ exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
if (fragment == NULL) {
|
if (fragment == NULL) {
|
||||||
xsltTransformError(tctxt, NULL, tctxt->inst,
|
xsltTransformError(tctxt, NULL, tctxt->inst,
|
||||||
"exsltNodeSetFunction: Failed to create a tree fragment.\n");
|
"exsltNodeSetFunction: Failed to create a tree fragment.\n");
|
||||||
tctxt->state = XSLT_STATE_STOPPED;
|
tctxt->state = XSLT_STATE_STOPPED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xsltRegisterLocalRVT(tctxt, fragment);
|
xsltRegisterLocalRVT(tctxt, fragment);
|
||||||
|
|
||||||
strval = xmlXPathPopString (ctxt);
|
strval = xmlXPathPopString (ctxt);
|
||||||
|
|
||||||
txt = xmlNewDocText (fragment, strval);
|
txt = xmlNewDocText (fragment, strval);
|
||||||
xmlAddChild((xmlNodePtr) fragment, txt);
|
xmlAddChild((xmlNodePtr) fragment, txt);
|
||||||
obj = xmlXPathNewNodeSet(txt);
|
obj = xmlXPathNewNodeSet(txt);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
xsltTransformError(tctxt, NULL, tctxt->inst,
|
xsltTransformError(tctxt, NULL, tctxt->inst,
|
||||||
"exsltNodeSetFunction: Failed to create a node set object.\n");
|
"exsltNodeSetFunction: Failed to create a node set object.\n");
|
||||||
@ -69,7 +69,7 @@ exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
}
|
}
|
||||||
if (strval != NULL)
|
if (strval != NULL)
|
||||||
xmlFree (strval);
|
xmlFree (strval);
|
||||||
|
|
||||||
valuePush (ctxt, obj);
|
valuePush (ctxt, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#define MD5_DIGEST_LENGTH 16
|
#define MD5_DIGEST_LENGTH 16
|
||||||
#define SHA1_DIGEST_LENGTH 20
|
#define SHA1_DIGEST_LENGTH 20
|
||||||
|
|
||||||
/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit
|
/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit
|
||||||
seems to be 128 for the default provider */
|
seems to be 128 for the default provider */
|
||||||
#define RC4_KEY_LENGTH 128
|
#define RC4_KEY_LENGTH 128
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
* @hex: buffer to store hex version of blob
|
* @hex: buffer to store hex version of blob
|
||||||
* @hexlen: length of buffer to store hex version of blob
|
* @hexlen: length of buffer to store hex version of blob
|
||||||
*
|
*
|
||||||
* Helper function which encodes a binary blob as hex.
|
* Helper function which encodes a binary blob as hex.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exsltCryptoBin2Hex (const unsigned char *bin, int binlen,
|
exsltCryptoBin2Hex (const unsigned char *bin, int binlen,
|
||||||
@ -357,7 +357,7 @@ exsltCryptoGcryptInit (void) {
|
|||||||
* @msglen: length of text to be hashed
|
* @msglen: length of text to be hashed
|
||||||
* @dest: buffer to place hash result
|
* @dest: buffer to place hash result
|
||||||
*
|
*
|
||||||
* Helper function which hashes a message using MD4, MD5, or SHA1.
|
* Helper function which hashes a message using MD4, MD5, or SHA1.
|
||||||
* using gcrypt
|
* using gcrypt
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
128
libexslt/date.c
128
libexslt/date.c
@ -99,7 +99,7 @@ typedef struct _exsltDateValDuration exsltDateValDuration;
|
|||||||
typedef exsltDateValDuration *exsltDateValDurationPtr;
|
typedef exsltDateValDuration *exsltDateValDurationPtr;
|
||||||
struct _exsltDateValDuration {
|
struct _exsltDateValDuration {
|
||||||
long mon; /* mon stores years also */
|
long mon; /* mon stores years also */
|
||||||
long day;
|
long day;
|
||||||
double sec; /* sec stores min and hour also */
|
double sec; /* sec stores min and hour also */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ struct _exsltDateVal {
|
|||||||
* *
|
* *
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#if defined(HAVE_TIME_H) \
|
#if defined(HAVE_TIME_H) \
|
||||||
&& (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
|
&& (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \
|
||||||
&& (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \
|
&& (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \
|
||||||
&& defined(HAVE_TIME)
|
&& defined(HAVE_TIME)
|
||||||
@ -791,27 +791,27 @@ exsltDateCurrent (void)
|
|||||||
local_s = localTm.tm_hour * SECS_PER_HOUR +
|
local_s = localTm.tm_hour * SECS_PER_HOUR +
|
||||||
localTm.tm_min * SECS_PER_MIN +
|
localTm.tm_min * SECS_PER_MIN +
|
||||||
localTm.tm_sec;
|
localTm.tm_sec;
|
||||||
|
|
||||||
gm_s = gmTm.tm_hour * SECS_PER_HOUR +
|
gm_s = gmTm.tm_hour * SECS_PER_HOUR +
|
||||||
gmTm.tm_min * SECS_PER_MIN +
|
gmTm.tm_min * SECS_PER_MIN +
|
||||||
gmTm.tm_sec;
|
gmTm.tm_sec;
|
||||||
|
|
||||||
if (localTm.tm_year < gmTm.tm_year) {
|
if (localTm.tm_year < gmTm.tm_year) {
|
||||||
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
||||||
} else if (localTm.tm_year > gmTm.tm_year) {
|
} else if (localTm.tm_year > gmTm.tm_year) {
|
||||||
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
||||||
} else if (localTm.tm_mon < gmTm.tm_mon) {
|
} else if (localTm.tm_mon < gmTm.tm_mon) {
|
||||||
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
||||||
} else if (localTm.tm_mon > gmTm.tm_mon) {
|
} else if (localTm.tm_mon > gmTm.tm_mon) {
|
||||||
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
||||||
} else if (localTm.tm_mday < gmTm.tm_mday) {
|
} else if (localTm.tm_mday < gmTm.tm_mday) {
|
||||||
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
|
||||||
} else if (localTm.tm_mday > gmTm.tm_mday) {
|
} else if (localTm.tm_mday > gmTm.tm_mday) {
|
||||||
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
|
||||||
} else {
|
} else {
|
||||||
ret->value.date.tzo = (local_s - gm_s)/60;
|
ret->value.date.tzo = (local_s - gm_s)/60;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1111,9 +1111,9 @@ exsltDateFormatDuration (const exsltDateValDurationPtr dt)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* quick and dirty check */
|
/* quick and dirty check */
|
||||||
if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0))
|
if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0))
|
||||||
return xmlStrdup((xmlChar*)"P0D");
|
return xmlStrdup((xmlChar*)"P0D");
|
||||||
|
|
||||||
secs = dt->sec;
|
secs = dt->sec;
|
||||||
days = (double)dt->day;
|
days = (double)dt->day;
|
||||||
years = (double)(dt->mon / 12);
|
years = (double)(dt->mon / 12);
|
||||||
@ -1123,15 +1123,15 @@ exsltDateFormatDuration (const exsltDateValDurationPtr dt)
|
|||||||
if (secs < 0.0) {
|
if (secs < 0.0) {
|
||||||
secs = -secs;
|
secs = -secs;
|
||||||
*cur = '-';
|
*cur = '-';
|
||||||
}
|
}
|
||||||
if (days < 0) {
|
if (days < 0) {
|
||||||
days = -days;
|
days = -days;
|
||||||
*cur = '-';
|
*cur = '-';
|
||||||
}
|
}
|
||||||
if (years < 0) {
|
if (years < 0) {
|
||||||
years = -years;
|
years = -years;
|
||||||
*cur = '-';
|
*cur = '-';
|
||||||
}
|
}
|
||||||
if (months < 0) {
|
if (months < 0) {
|
||||||
months = -months;
|
months = -months;
|
||||||
*cur = '-';
|
*cur = '-';
|
||||||
@ -1301,7 +1301,7 @@ exsltDateFormat (const exsltDateValPtr dt)
|
|||||||
* _exsltDateCastYMToDays:
|
* _exsltDateCastYMToDays:
|
||||||
* @dt: an #exsltDateValPtr
|
* @dt: an #exsltDateValPtr
|
||||||
*
|
*
|
||||||
* Convert mon and year of @dt to total number of days. Take the
|
* Convert mon and year of @dt to total number of days. Take the
|
||||||
* number of years since (or before) 1 AD and add the number of leap
|
* number of years since (or before) 1 AD and add the number of leap
|
||||||
* years. This is a function because negative
|
* years. This is a function because negative
|
||||||
* years must be handled a little differently and there is no zero year.
|
* years must be handled a little differently and there is no zero year.
|
||||||
@ -1414,7 +1414,7 @@ _exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type)
|
|||||||
* @yr: year
|
* @yr: year
|
||||||
*
|
*
|
||||||
* Determine the day-in-week from @yday and @yr. 0001-01-01 was
|
* Determine the day-in-week from @yday and @yr. 0001-01-01 was
|
||||||
* a Monday so all other days are calculated from there. Take the
|
* a Monday so all other days are calculated from there. Take the
|
||||||
* number of years since (or before) add the number of leap years and
|
* number of years since (or before) add the number of leap years and
|
||||||
* the day-in-year and mod by 7. This is a function because negative
|
* the day-in-year and mod by 7. This is a function because negative
|
||||||
* years must be handled a little differently and there is no zero year.
|
* years must be handled a little differently and there is no zero year.
|
||||||
@ -1428,7 +1428,7 @@ _exsltDateDayInWeek(long yday, long yr)
|
|||||||
|
|
||||||
if (yr < 0) {
|
if (yr < 0) {
|
||||||
ret = ((yr + (((yr+1)/4)-((yr+1)/100)+((yr+1)/400)) + yday) % 7);
|
ret = ((yr + (((yr+1)/4)-((yr+1)/100)+((yr+1)/400)) + yday) % 7);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ret += 7;
|
ret += 7;
|
||||||
} else
|
} else
|
||||||
ret = (((yr-1) + (((yr-1)/4)-((yr-1)/100)+((yr-1)/400)) + yday) % 7);
|
ret = (((yr-1) + (((yr-1)/4)-((yr-1)/100)+((yr-1)/400)) + yday) % 7);
|
||||||
@ -1542,7 +1542,7 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur)
|
|||||||
if (tyr == 0)
|
if (tyr == 0)
|
||||||
tyr--;
|
tyr--;
|
||||||
/*
|
/*
|
||||||
* Coverity detected an overrun in daysInMonth
|
* Coverity detected an overrun in daysInMonth
|
||||||
* of size 12 at position 12 with index variable "((r)->mon - 1)"
|
* of size 12 at position 12 with index variable "((r)->mon - 1)"
|
||||||
*/
|
*/
|
||||||
if (tmon < 0)
|
if (tmon < 0)
|
||||||
@ -1567,7 +1567,7 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur)
|
|||||||
r->year++;
|
r->year++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r->day = tempdays;
|
r->day = tempdays;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1642,7 +1642,7 @@ _exsltDateDifference (exsltDateValPtr x, exsltDateValPtr y, int flag)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) ||
|
if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) ||
|
||||||
((y->type < XS_GYEAR) || (y->type > XS_DATETIME)))
|
((y->type < XS_GYEAR) || (y->type > XS_DATETIME)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
exsltDateNormalize(x);
|
exsltDateNormalize(x);
|
||||||
@ -1779,7 +1779,7 @@ _exsltDateAddDuration (exsltDateValPtr x, exsltDateValPtr y)
|
|||||||
*
|
*
|
||||||
* Implements the EXSLT - Dates and Times date-time() function:
|
* Implements the EXSLT - Dates and Times date-time() function:
|
||||||
* string date:date-time()
|
* string date:date-time()
|
||||||
*
|
*
|
||||||
* Returns the current date and time as a date/time string.
|
* Returns the current date and time as a date/time string.
|
||||||
*/
|
*/
|
||||||
static xmlChar *
|
static xmlChar *
|
||||||
@ -1805,7 +1805,7 @@ exsltDateDateTime (void)
|
|||||||
*
|
*
|
||||||
* Implements the EXSLT - Dates and Times date() function:
|
* Implements the EXSLT - Dates and Times date() function:
|
||||||
* string date:date (string?)
|
* string date:date (string?)
|
||||||
*
|
*
|
||||||
* Returns the date specified in the date/time string given as the
|
* Returns the date specified in the date/time string given as the
|
||||||
* argument. If no argument is given, then the current local
|
* argument. If no argument is given, then the current local
|
||||||
* date/time, as returned by date:date-time is used as a default
|
* date/time, as returned by date:date-time is used as a default
|
||||||
@ -1849,7 +1849,7 @@ exsltDateDate (const xmlChar *dateTime)
|
|||||||
*
|
*
|
||||||
* Implements the EXSLT - Dates and Times time() function:
|
* Implements the EXSLT - Dates and Times time() function:
|
||||||
* string date:time (string?)
|
* string date:time (string?)
|
||||||
*
|
*
|
||||||
* Returns the time specified in the date/time string given as the
|
* Returns the time specified in the date/time string given as the
|
||||||
* argument. If no argument is given, then the current local
|
* argument. If no argument is given, then the current local
|
||||||
* date/time, as returned by date:date-time is used as a default
|
* date/time, as returned by date:date-time is used as a default
|
||||||
@ -2630,7 +2630,7 @@ exsltDateMinuteInHour (const xmlChar *dateTime)
|
|||||||
* - xs:time (hh:mm:ss)
|
* - xs:time (hh:mm:ss)
|
||||||
* If the date/time string is not in one of these formats, then NaN is
|
* If the date/time string is not in one of these formats, then NaN is
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
* Returns the second or NaN.
|
* Returns the second or NaN.
|
||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
@ -2667,21 +2667,21 @@ exsltDateSecondInMinute (const xmlChar *dateTime)
|
|||||||
* @ystr: date/time string
|
* @ystr: date/time string
|
||||||
*
|
*
|
||||||
* Implements the date:add (string,string) function which returns the
|
* Implements the date:add (string,string) function which returns the
|
||||||
* date/time * resulting from adding a duration to a date/time.
|
* date/time * resulting from adding a duration to a date/time.
|
||||||
* The first argument (@xstr) must be right-truncated date/time
|
* The first argument (@xstr) must be right-truncated date/time
|
||||||
* strings in one of the formats defined in [XML Schema Part 2:
|
* strings in one of the formats defined in [XML Schema Part 2:
|
||||||
* Datatypes]. The permitted formats are as follows:
|
* Datatypes]. The permitted formats are as follows:
|
||||||
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
||||||
* - xs:date (CCYY-MM-DD)
|
* - xs:date (CCYY-MM-DD)
|
||||||
* - xs:gYearMonth (CCYY-MM)
|
* - xs:gYearMonth (CCYY-MM)
|
||||||
* - xs:gYear (CCYY)
|
* - xs:gYear (CCYY)
|
||||||
* The second argument (@ystr) is a string in the format defined for
|
* The second argument (@ystr) is a string in the format defined for
|
||||||
* xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
* xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
||||||
* The return value is a right-truncated date/time strings in one of
|
* The return value is a right-truncated date/time strings in one of
|
||||||
* the formats defined in [XML Schema Part 2: Datatypes] and listed
|
* the formats defined in [XML Schema Part 2: Datatypes] and listed
|
||||||
* above. This value is calculated using the algorithm described in
|
* above. This value is calculated using the algorithm described in
|
||||||
* [Appendix E Adding durations to dateTimes] of [XML Schema Part 2:
|
* [Appendix E Adding durations to dateTimes] of [XML Schema Part 2:
|
||||||
* Datatypes].
|
* Datatypes].
|
||||||
|
|
||||||
* Returns date/time string or NULL.
|
* Returns date/time string or NULL.
|
||||||
*/
|
*/
|
||||||
@ -2689,7 +2689,7 @@ static xmlChar *
|
|||||||
exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr)
|
exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr)
|
||||||
{
|
{
|
||||||
exsltDateValPtr dt, dur, res;
|
exsltDateValPtr dt, dur, res;
|
||||||
xmlChar *ret;
|
xmlChar *ret;
|
||||||
|
|
||||||
if ((xstr == NULL) || (ystr == NULL))
|
if ((xstr == NULL) || (ystr == NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2728,18 +2728,18 @@ exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr)
|
|||||||
* @ystr: second duration string
|
* @ystr: second duration string
|
||||||
*
|
*
|
||||||
* Implements the date:add-duration (string,string) function which returns
|
* Implements the date:add-duration (string,string) function which returns
|
||||||
* the duration resulting from adding two durations together.
|
* the duration resulting from adding two durations together.
|
||||||
* Both arguments are strings in the format defined for xs:duration
|
* Both arguments are strings in the format defined for xs:duration
|
||||||
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either
|
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either
|
||||||
* argument is not in this format, the function returns an empty string
|
* argument is not in this format, the function returns an empty string
|
||||||
* ('').
|
* ('').
|
||||||
* The return value is a string in the format defined for xs:duration
|
* The return value is a string in the format defined for xs:duration
|
||||||
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
||||||
* The durations can usually be added by summing the numbers given for
|
* The durations can usually be added by summing the numbers given for
|
||||||
* each of the components in the durations. However, if the durations
|
* each of the components in the durations. However, if the durations
|
||||||
* are differently signed, then this sometimes results in durations
|
* are differently signed, then this sometimes results in durations
|
||||||
* that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
|
* that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
|
||||||
* In these cases, the function returns an empty string ('').
|
* In these cases, the function returns an empty string ('').
|
||||||
*
|
*
|
||||||
* Returns duration string or NULL.
|
* Returns duration string or NULL.
|
||||||
*/
|
*/
|
||||||
@ -2747,7 +2747,7 @@ static xmlChar *
|
|||||||
exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr)
|
exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr)
|
||||||
{
|
{
|
||||||
exsltDateValPtr x, y, res;
|
exsltDateValPtr x, y, res;
|
||||||
xmlChar *ret;
|
xmlChar *ret;
|
||||||
|
|
||||||
if ((xstr == NULL) || (ystr == NULL))
|
if ((xstr == NULL) || (ystr == NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2780,18 +2780,18 @@ exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr)
|
|||||||
* exsltDateSumFunction:
|
* exsltDateSumFunction:
|
||||||
* @ns: a node set of duration strings
|
* @ns: a node set of duration strings
|
||||||
*
|
*
|
||||||
* The date:sum function adds a set of durations together.
|
* The date:sum function adds a set of durations together.
|
||||||
* The string values of the nodes in the node set passed as an argument
|
* The string values of the nodes in the node set passed as an argument
|
||||||
* are interpreted as durations and added together as if using the
|
* are interpreted as durations and added together as if using the
|
||||||
* date:add-duration function. (from exslt.org)
|
* date:add-duration function. (from exslt.org)
|
||||||
*
|
*
|
||||||
* The return value is a string in the format defined for xs:duration
|
* The return value is a string in the format defined for xs:duration
|
||||||
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
||||||
* The durations can usually be added by summing the numbers given for
|
* The durations can usually be added by summing the numbers given for
|
||||||
* each of the components in the durations. However, if the durations
|
* each of the components in the durations. However, if the durations
|
||||||
* are differently signed, then this sometimes results in durations
|
* are differently signed, then this sometimes results in durations
|
||||||
* that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
|
* that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
|
||||||
* In these cases, the function returns an empty string ('').
|
* In these cases, the function returns an empty string ('').
|
||||||
*
|
*
|
||||||
* Returns duration string or NULL.
|
* Returns duration string or NULL.
|
||||||
*/
|
*/
|
||||||
@ -2835,7 +2835,7 @@ exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ns->nodeNr; i++) {
|
for (i = 0; i < ns->nodeNr; i++) {
|
||||||
int result;
|
int result;
|
||||||
tmp = xmlXPathCastNodeToString (ns->nodeTab[i]);
|
tmp = xmlXPathCastNodeToString (ns->nodeTab[i]);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
xmlXPathFreeNodeSet (ns);
|
xmlXPathFreeNodeSet (ns);
|
||||||
@ -2888,13 +2888,13 @@ exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
* local date/time, as returned by exsltDateCurrent() is used as the
|
* local date/time, as returned by exsltDateCurrent() is used as the
|
||||||
* default argument. If the date/time string is a xs:duration, then the
|
* default argument. If the date/time string is a xs:duration, then the
|
||||||
* years and months must be zero (or not present). Parsing a duration
|
* years and months must be zero (or not present). Parsing a duration
|
||||||
* converts the fields to seconds. If the date/time string is not a
|
* converts the fields to seconds. If the date/time string is not a
|
||||||
* duration (and not null), then the legal formats are:
|
* duration (and not null), then the legal formats are:
|
||||||
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
||||||
* - xs:date (CCYY-MM-DD)
|
* - xs:date (CCYY-MM-DD)
|
||||||
* - xs:gYearMonth (CCYY-MM)
|
* - xs:gYearMonth (CCYY-MM)
|
||||||
* - xs:gYear (CCYY)
|
* - xs:gYear (CCYY)
|
||||||
* In these cases the difference between the @dateTime and
|
* In these cases the difference between the @dateTime and
|
||||||
* 1970-01-01T00:00:00Z is calculated and converted to seconds.
|
* 1970-01-01T00:00:00Z is calculated and converted to seconds.
|
||||||
*
|
*
|
||||||
* Note that there was some confusion over whether "difference" meant
|
* Note that there was some confusion over whether "difference" meant
|
||||||
@ -2942,7 +2942,7 @@ exsltDateSeconds (const xmlChar *dateTime)
|
|||||||
|
|
||||||
dur = _exsltDateDifference(y, dt, 1);
|
dur = _exsltDateDifference(y, dt, 1);
|
||||||
if (dur != NULL) {
|
if (dur != NULL) {
|
||||||
ret = exsltDateCastDateToNumber(dur);
|
ret = exsltDateCastDateToNumber(dur);
|
||||||
exsltDateFreeDate(dur);
|
exsltDateFreeDate(dur);
|
||||||
}
|
}
|
||||||
exsltDateFreeDate(y);
|
exsltDateFreeDate(y);
|
||||||
@ -2970,26 +2970,26 @@ exsltDateSeconds (const xmlChar *dateTime)
|
|||||||
* 2: Datatypes]. The date/time with the most specific format (i.e. the
|
* 2: Datatypes]. The date/time with the most specific format (i.e. the
|
||||||
* least truncation) is converted into the same format as the date with
|
* least truncation) is converted into the same format as the date with
|
||||||
* the least specific format (i.e. the most truncation). The permitted
|
* the least specific format (i.e. the most truncation). The permitted
|
||||||
* formats are as follows, from most specific to least specific:
|
* formats are as follows, from most specific to least specific:
|
||||||
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
* - xs:dateTime (CCYY-MM-DDThh:mm:ss)
|
||||||
* - xs:date (CCYY-MM-DD)
|
* - xs:date (CCYY-MM-DD)
|
||||||
* - xs:gYearMonth (CCYY-MM)
|
* - xs:gYearMonth (CCYY-MM)
|
||||||
* - xs:gYear (CCYY)
|
* - xs:gYear (CCYY)
|
||||||
* If either of the arguments is not in one of these formats,
|
* If either of the arguments is not in one of these formats,
|
||||||
* date:difference returns the empty string ('').
|
* date:difference returns the empty string ('').
|
||||||
* The difference between the date/times is returned as a string in the
|
* The difference between the date/times is returned as a string in the
|
||||||
* format defined for xs:duration in [3.2.6 duration] of [XML Schema
|
* format defined for xs:duration in [3.2.6 duration] of [XML Schema
|
||||||
* Part 2: Datatypes].
|
* Part 2: Datatypes].
|
||||||
* If the date/time string with the least specific format is in either
|
* If the date/time string with the least specific format is in either
|
||||||
* xs:gYearMonth or xs:gYear format, then the number of days, hours,
|
* xs:gYearMonth or xs:gYear format, then the number of days, hours,
|
||||||
* minutes and seconds in the duration string must be equal to zero.
|
* minutes and seconds in the duration string must be equal to zero.
|
||||||
* (The format of the string will be PnYnM.) The number of months
|
* (The format of the string will be PnYnM.) The number of months
|
||||||
* specified in the duration must be less than 12.
|
* specified in the duration must be less than 12.
|
||||||
* Otherwise, the number of years and months in the duration string
|
* Otherwise, the number of years and months in the duration string
|
||||||
* must be equal to zero. (The format of the string will be
|
* must be equal to zero. (The format of the string will be
|
||||||
* PnDTnHnMnS.) The number of seconds specified in the duration string
|
* PnDTnHnMnS.) The number of seconds specified in the duration string
|
||||||
* must be less than 60; the number of minutes must be less than 60;
|
* must be less than 60; the number of minutes must be less than 60;
|
||||||
* the number of hours must be less than 24.
|
* the number of hours must be less than 24.
|
||||||
*
|
*
|
||||||
* Returns duration string or NULL.
|
* Returns duration string or NULL.
|
||||||
*/
|
*/
|
||||||
@ -2997,7 +2997,7 @@ static xmlChar *
|
|||||||
exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr)
|
exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr)
|
||||||
{
|
{
|
||||||
exsltDateValPtr x, y, dur;
|
exsltDateValPtr x, y, dur;
|
||||||
xmlChar *ret = NULL;
|
xmlChar *ret = NULL;
|
||||||
|
|
||||||
if ((xstr == NULL) || (ystr == NULL))
|
if ((xstr == NULL) || (ystr == NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3040,16 +3040,16 @@ exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr)
|
|||||||
* Implements the The date:duration function returns a duration string
|
* Implements the The date:duration function returns a duration string
|
||||||
* representing the number of seconds specified by the argument string.
|
* representing the number of seconds specified by the argument string.
|
||||||
* If no argument is given, then the result of calling date:seconds
|
* If no argument is given, then the result of calling date:seconds
|
||||||
* without any arguments is used as a default argument.
|
* without any arguments is used as a default argument.
|
||||||
* The duration is returned as a string in the format defined for
|
* The duration is returned as a string in the format defined for
|
||||||
* xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
* xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
||||||
* The number of years and months in the duration string must be equal
|
* The number of years and months in the duration string must be equal
|
||||||
* to zero. (The format of the string will be PnDTnHnMnS.) The number
|
* to zero. (The format of the string will be PnDTnHnMnS.) The number
|
||||||
* of seconds specified in the duration string must be less than 60;
|
* of seconds specified in the duration string must be less than 60;
|
||||||
* the number of minutes must be less than 60; the number of hours must
|
* the number of minutes must be less than 60; the number of hours must
|
||||||
* be less than 24.
|
* be less than 24.
|
||||||
* If the argument is Infinity, -Infinity or NaN, then date:duration
|
* If the argument is Infinity, -Infinity or NaN, then date:duration
|
||||||
* returns an empty string ('').
|
* returns an empty string ('').
|
||||||
*
|
*
|
||||||
* Returns duration string or NULL.
|
* Returns duration string or NULL.
|
||||||
*/
|
*/
|
||||||
|
@ -74,11 +74,11 @@ exsltDynEvaluateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
ret = xmlXPathEval(str,ctxt->context);
|
ret = xmlXPathEval(str,ctxt->context);
|
||||||
if (ret)
|
if (ret)
|
||||||
valuePush(ctxt,ret);
|
valuePush(ctxt,ret);
|
||||||
else {
|
else {
|
||||||
xsltGenericError(xsltGenericErrorContext,
|
xsltGenericError(xsltGenericErrorContext,
|
||||||
"dyn:evaluate() : unable to evaluate expression '%s'\n",str);
|
"dyn:evaluate() : unable to evaluate expression '%s'\n",str);
|
||||||
valuePush(ctxt,xmlXPathNewNodeSet(NULL));
|
valuePush(ctxt,xmlXPathNewNodeSet(NULL));
|
||||||
}
|
}
|
||||||
xmlFree(str);
|
xmlFree(str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -144,9 +144,9 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
oldContextSize = ctxt->context->contextSize;
|
oldContextSize = ctxt->context->contextSize;
|
||||||
oldProximityPosition = ctxt->context->proximityPosition;
|
oldProximityPosition = ctxt->context->proximityPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* since we really don't know we're going to be adding node(s)
|
* since we really don't know we're going to be adding node(s)
|
||||||
* down the road we create the RVT regardless
|
* down the road we create the RVT regardless
|
||||||
*/
|
*/
|
||||||
tctxt = xsltXPathGetTransformContext(ctxt);
|
tctxt = xsltXPathGetTransformContext(ctxt);
|
||||||
if (tctxt == NULL) {
|
if (tctxt == NULL) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <libexslt/exsltconfig.h>
|
#include <libexslt/exsltconfig.h>
|
||||||
#include "exslt.h"
|
#include "exslt.h"
|
||||||
|
|
||||||
const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING
|
const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING
|
||||||
LIBEXSLT_VERSION_EXTRA;
|
LIBEXSLT_VERSION_EXTRA;
|
||||||
const int exsltLibexsltVersion = LIBEXSLT_VERSION;
|
const int exsltLibexsltVersion = LIBEXSLT_VERSION;
|
||||||
const int exsltLibxsltVersion = LIBXSLT_VERSION;
|
const int exsltLibxsltVersion = LIBXSLT_VERSION;
|
||||||
|
@ -106,16 +106,16 @@ exsltFuncRegisterImportFunc (exsltFuncFunctionData *data,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->ctxt == NULL || ch->hash == NULL)
|
if (ch->ctxt == NULL || ch->hash == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if already present */
|
/* Check if already present */
|
||||||
func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name);
|
func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name);
|
||||||
if (func == NULL) { /* Not yet present - copy it in */
|
if (func == NULL) { /* Not yet present - copy it in */
|
||||||
func = exsltFuncNewFunctionData();
|
func = exsltFuncNewFunctionData();
|
||||||
memcpy(func, data, sizeof(exsltFuncFunctionData));
|
memcpy(func, data, sizeof(exsltFuncFunctionData));
|
||||||
if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) {
|
if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) {
|
||||||
xsltGenericError(xsltGenericErrorContext,
|
xsltGenericError(xsltGenericErrorContext,
|
||||||
"Failed to register function {%s}%s\n",
|
"Failed to register function {%s}%s\n",
|
||||||
URI, name);
|
URI, name);
|
||||||
} else { /* Do the registration */
|
} else { /* Do the registration */
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
@ -146,7 +146,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
xsltStylesheetPtr tmp;
|
xsltStylesheetPtr tmp;
|
||||||
exsltFuncImportRegData ch;
|
exsltFuncImportRegData ch;
|
||||||
xmlHashTablePtr hash;
|
xmlHashTablePtr hash;
|
||||||
|
|
||||||
ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
|
ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
xsltGenericError(xsltGenericErrorContext,
|
xsltGenericError(xsltGenericErrorContext,
|
||||||
@ -166,7 +166,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
while ((tmp=xsltNextImport(tmp))!=NULL) {
|
while ((tmp=xsltNextImport(tmp))!=NULL) {
|
||||||
hash = xsltGetExtInfo(tmp, URI);
|
hash = xsltGetExtInfo(tmp, URI);
|
||||||
if (hash != NULL) {
|
if (hash != NULL) {
|
||||||
xmlHashScanFull(hash,
|
xmlHashScanFull(hash,
|
||||||
(xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch);
|
(xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
* @ctxt: an XSLT transformation context
|
* @ctxt: an XSLT transformation context
|
||||||
* @URI: the namespace URI for the extension
|
* @URI: the namespace URI for the extension
|
||||||
* @data: the module data to free up
|
* @data: the module data to free up
|
||||||
*
|
*
|
||||||
* Shutdown the EXSLT - Functions module
|
* Shutdown the EXSLT - Functions module
|
||||||
* Called at transformation-time.
|
* Called at transformation-time.
|
||||||
*/
|
*/
|
||||||
@ -212,7 +212,7 @@ exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
|
|||||||
* exsltFuncStyleShutdown:
|
* exsltFuncStyleShutdown:
|
||||||
* @style: an XSLT stylesheet
|
* @style: an XSLT stylesheet
|
||||||
* @URI: the namespace URI for the extension
|
* @URI: the namespace URI for the extension
|
||||||
* @data: the stylesheet data to free up
|
* @data: the stylesheet data to free up
|
||||||
*
|
*
|
||||||
* Shutdown the EXSLT - Function module
|
* Shutdown the EXSLT - Function module
|
||||||
* Called at compile-time.
|
* Called at compile-time.
|
||||||
@ -350,7 +350,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
* which is not very nice. There is probably a much better solution
|
* which is not very nice. There is probably a much better solution
|
||||||
* (like change other code to delay the evaluation).
|
* (like change other code to delay the evaluation).
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* In order to give the function params and variables a new 'scope'
|
* In order to give the function params and variables a new 'scope'
|
||||||
* we change varsBase in the context.
|
* we change varsBase in the context.
|
||||||
*/
|
*/
|
||||||
@ -411,7 +411,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
tctxt->insert = oldInsert;
|
tctxt->insert = oldInsert;
|
||||||
tctxt->varsBase = oldBase; /* restore original scope */
|
tctxt->varsBase = oldBase; /* restore original scope */
|
||||||
if (params != NULL)
|
if (params != NULL)
|
||||||
xsltFreeStackElemList(params);
|
xsltFreeStackElemList(params);
|
||||||
|
|
||||||
if (data->error != 0)
|
if (data->error != 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -570,7 +570,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
* it is an error if a func:result occurs within a func:result
|
* it is an error if a func:result occurs within a func:result
|
||||||
* element.
|
* element.
|
||||||
* it is an error if instanciating the content of a variable
|
* it is an error if instanciating the content of a variable
|
||||||
* binding element (i.e. xsl:variable, xsl:param) results in the
|
* binding element (i.e. xsl:variable, xsl:param) results in the
|
||||||
* instanciation of a func:result element.
|
* instanciation of a func:result element.
|
||||||
*/
|
*/
|
||||||
for (test = inst->parent; test != NULL; test = test->parent) {
|
for (test = inst->parent; test != NULL; test = test->parent) {
|
||||||
@ -651,7 +651,7 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
|||||||
exsltFuncResultPreComp *comp) {
|
exsltFuncResultPreComp *comp) {
|
||||||
exsltFuncData *data;
|
exsltFuncData *data;
|
||||||
xmlXPathObjectPtr ret;
|
xmlXPathObjectPtr ret;
|
||||||
|
|
||||||
|
|
||||||
/* It is an error if instantiating the content of the
|
/* It is an error if instantiating the content of the
|
||||||
* func:function element results in the instantiation of more than
|
* func:function element results in the instantiation of more than
|
||||||
@ -727,7 +727,7 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
|||||||
data->error = 1;
|
data->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xsltRegisterLocalRVT(ctxt, container);
|
xsltRegisterLocalRVT(ctxt, container);
|
||||||
|
|
||||||
oldInsert = ctxt->insert;
|
oldInsert = ctxt->insert;
|
||||||
ctxt->insert = (xmlNodePtr) container;
|
ctxt->insert = (xmlNodePtr) container;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC
|
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC
|
||||||
#define LIBEXSLT_PUBLIC __declspec(dllimport)
|
#define LIBEXSLT_PUBLIC __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define LIBEXSLT_PUBLIC
|
#define LIBEXSLT_PUBLIC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ static void
|
|||||||
exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||||
xmlNodeSetPtr ns, ret;
|
xmlNodeSetPtr ns, ret;
|
||||||
void *user = NULL;
|
void *user = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
xmlXPathSetArityError(ctxt);
|
xmlXPathSetArityError(ctxt);
|
||||||
@ -368,7 +368,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_PI, 0, len);
|
str = xmlStrsub(EXSLT_PI, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "E")) {
|
} else if (xmlStrEqual(name, BAD_CAST "E")) {
|
||||||
@ -376,7 +376,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_E, 0, len);
|
str = xmlStrsub(EXSLT_E, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) {
|
} else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) {
|
||||||
@ -384,7 +384,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_SQRRT2, 0, len);
|
str = xmlStrsub(EXSLT_SQRRT2, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "LN2")) {
|
} else if (xmlStrEqual(name, BAD_CAST "LN2")) {
|
||||||
@ -392,7 +392,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_LN2, 0, len);
|
str = xmlStrsub(EXSLT_LN2, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "LN10")) {
|
} else if (xmlStrEqual(name, BAD_CAST "LN10")) {
|
||||||
@ -400,7 +400,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_LN10, 0, len);
|
str = xmlStrsub(EXSLT_LN10, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "LOG2E")) {
|
} else if (xmlStrEqual(name, BAD_CAST "LOG2E")) {
|
||||||
@ -408,7 +408,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_LOG2E, 0, len);
|
str = xmlStrsub(EXSLT_LOG2E, 0, len);
|
||||||
|
|
||||||
} else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) {
|
} else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) {
|
||||||
@ -416,7 +416,7 @@ exsltMathConstant (xmlChar *name, double precision) {
|
|||||||
|
|
||||||
if (precision <= len)
|
if (precision <= len)
|
||||||
len = (int)precision;
|
len = (int)precision;
|
||||||
|
|
||||||
str = xmlStrsub(EXSLT_SQRT1_2, 0, len);
|
str = xmlStrsub(EXSLT_SQRT1_2, 0, len);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -209,7 +209,7 @@ exsltSaxonSystemIdFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
* exsltSaxonLineNumberFunction:
|
* exsltSaxonLineNumberFunction:
|
||||||
* @ctxt: an XPath parser context
|
* @ctxt: an XPath parser context
|
||||||
* @nargs: number of arguments
|
* @nargs: number of arguments
|
||||||
*
|
*
|
||||||
* Implements the SAXON line-number() function
|
* Implements the SAXON line-number() function
|
||||||
* integer saxon:line-number()
|
* integer saxon:line-number()
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* @nargs: the number of arguments
|
* @nargs: the number of arguments
|
||||||
*
|
*
|
||||||
* Splits up a string on the characters of the delimiter string and returns a
|
* Splits up a string on the characters of the delimiter string and returns a
|
||||||
* node set of token elements, each containing one token from the string.
|
* node set of token elements, each containing one token from the string.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
||||||
@ -106,7 +106,7 @@ exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (token != cur) {
|
if (token != cur) {
|
||||||
node = xmlNewDocRawNode(container, NULL,
|
node = xmlNewDocRawNode(container, NULL,
|
||||||
(const xmlChar *) "token", token);
|
(const xmlChar *) "token", token);
|
||||||
xmlAddChild((xmlNodePtr) container, node);
|
xmlAddChild((xmlNodePtr) container, node);
|
||||||
xmlXPathNodeSetAddUnique(ret->nodesetval, node);
|
xmlXPathNodeSetAddUnique(ret->nodesetval, node);
|
||||||
@ -136,7 +136,7 @@ fail:
|
|||||||
* @nargs: the number of arguments
|
* @nargs: the number of arguments
|
||||||
*
|
*
|
||||||
* Splits up a string on a delimiting string and returns a node set of token
|
* Splits up a string on a delimiting string and returns a node set of token
|
||||||
* elements, each containing one token from the string.
|
* elements, each containing one token from the string.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
exsltStrSplitFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
exsltStrSplitFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||||
@ -335,7 +335,7 @@ exsltStrDecodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
xmlFree(ret);
|
xmlFree(ret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlXPathReturnString(ctxt, ret);
|
xmlXPathReturnString(ctxt, ret);
|
||||||
|
|
||||||
if (str != NULL)
|
if (str != NULL)
|
||||||
@ -552,7 +552,7 @@ exsltStrReturnString(xmlXPathParserContextPtr ctxt, const xmlChar *str,
|
|||||||
* @ctxt: an XPath parser context
|
* @ctxt: an XPath parser context
|
||||||
* @nargs: the number of arguments
|
* @nargs: the number of arguments
|
||||||
*
|
*
|
||||||
* Takes a string, and two node sets and returns the string with all strings in
|
* Takes a string, and two node sets and returns the string with all strings in
|
||||||
* the first node set replaced by all strings in the second node set.
|
* the first node set replaced by all strings in the second node set.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -140,7 +140,7 @@ xsltFreeAttrElem(xsltAttrElemPtr attr) {
|
|||||||
static void
|
static void
|
||||||
xsltFreeAttrElemList(xsltAttrElemPtr list) {
|
xsltFreeAttrElemList(xsltAttrElemPtr list) {
|
||||||
xsltAttrElemPtr next;
|
xsltAttrElemPtr next;
|
||||||
|
|
||||||
while (list != NULL) {
|
while (list != NULL) {
|
||||||
next = list->next;
|
next = list->next;
|
||||||
xsltFreeAttrElem(list);
|
xsltFreeAttrElem(list);
|
||||||
@ -171,7 +171,7 @@ xsltAddAttrElemList(xsltAttrElemPtr list, xmlNodePtr attr) {
|
|||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
return(xsltNewAttrElem(attr));
|
return(xsltNewAttrElem(attr));
|
||||||
cur = list;
|
cur = list;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
next = cur->next;
|
next = cur->next;
|
||||||
if (cur->attr == attr)
|
if (cur->attr == attr)
|
||||||
return(cur);
|
return(cur);
|
||||||
@ -375,7 +375,7 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
attrItems = curAttr;
|
attrItems = curAttr;
|
||||||
goto next_child;
|
goto next_child;
|
||||||
}
|
}
|
||||||
if (curAttr->next == NULL)
|
if (curAttr->next == NULL)
|
||||||
curAttr->next = xsltNewAttrElem(child);
|
curAttr->next = xsltNewAttrElem(child);
|
||||||
curAttr = nextAttr;
|
curAttr = nextAttr;
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ next_child:
|
|||||||
/*
|
/*
|
||||||
* Process attribue "use-attribute-sets".
|
* Process attribue "use-attribute-sets".
|
||||||
*/
|
*/
|
||||||
/* TODO check recursion */
|
/* TODO check recursion */
|
||||||
value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
|
value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
|
||||||
NULL);
|
NULL);
|
||||||
if (value != NULL) {
|
if (value != NULL) {
|
||||||
@ -422,7 +422,7 @@ next_child:
|
|||||||
const xmlChar *ncname2 = NULL;
|
const xmlChar *ncname2 = NULL;
|
||||||
const xmlChar *prefix2 = NULL;
|
const xmlChar *prefix2 = NULL;
|
||||||
xsltAttrElemPtr refAttrItems;
|
xsltAttrElemPtr refAttrItems;
|
||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
|
#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"xsl:attribute-set : %s adds use %s\n", ncname, curval);
|
"xsl:attribute-set : %s adds use %s\n", ncname, curval);
|
||||||
@ -605,7 +605,7 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) {
|
|||||||
#endif
|
#endif
|
||||||
style->attributeSets = xmlHashCreate(10);
|
style->attributeSets = xmlHashCreate(10);
|
||||||
}
|
}
|
||||||
xmlHashScanFull(cur->attributeSets,
|
xmlHashScanFull(cur->attributeSets,
|
||||||
(xmlHashScannerFull) xsltMergeSASCallback, style);
|
(xmlHashScannerFull) xsltMergeSASCallback, style);
|
||||||
/*
|
/*
|
||||||
* the attribute lists have either been migrated to style
|
* the attribute lists have either been migrated to style
|
||||||
@ -621,7 +621,7 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) {
|
|||||||
* Then resolve all the references and computes the resulting sets
|
* Then resolve all the references and computes the resulting sets
|
||||||
*/
|
*/
|
||||||
if (style->attributeSets != NULL) {
|
if (style->attributeSets != NULL) {
|
||||||
xmlHashScanFull(style->attributeSets,
|
xmlHashScanFull(style->attributeSets,
|
||||||
(xmlHashScannerFull) xsltResolveSASCallback, style);
|
(xmlHashScannerFull) xsltResolveSASCallback, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -645,22 +645,22 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
{
|
{
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
xsltStyleItemAttributePtr comp =
|
xsltStyleItemAttributePtr comp =
|
||||||
(xsltStyleItemAttributePtr) castedComp;
|
(xsltStyleItemAttributePtr) castedComp;
|
||||||
#else
|
#else
|
||||||
xsltStylePreCompPtr comp = castedComp;
|
xsltStylePreCompPtr comp = castedComp;
|
||||||
#endif
|
#endif
|
||||||
xmlNodePtr targetElem;
|
xmlNodePtr targetElem;
|
||||||
xmlChar *prop = NULL;
|
xmlChar *prop = NULL;
|
||||||
const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL;
|
const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL;
|
||||||
xmlChar *value = NULL;
|
xmlChar *value = NULL;
|
||||||
xmlNsPtr ns = NULL;
|
xmlNsPtr ns = NULL;
|
||||||
xmlAttrPtr attr;
|
xmlAttrPtr attr;
|
||||||
|
|
||||||
if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
|
if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
|
||||||
(inst->type != XML_ELEMENT_NODE) )
|
(inst->type != XML_ELEMENT_NODE) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A comp->has_name == 0 indicates that we need to skip this instruction,
|
* A comp->has_name == 0 indicates that we need to skip this instruction,
|
||||||
* since it was evaluated to be invalid already during compilation.
|
* since it was evaluated to be invalid already during compilation.
|
||||||
*/
|
*/
|
||||||
@ -690,7 +690,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
* So report an internal error?
|
* So report an internal error?
|
||||||
*/
|
*/
|
||||||
if (ctxt->insert == NULL)
|
if (ctxt->insert == NULL)
|
||||||
return;
|
return;
|
||||||
/*
|
/*
|
||||||
* SPEC XSLT 1.0:
|
* SPEC XSLT 1.0:
|
||||||
* "Adding an attribute to a node that is not an element;
|
* "Adding an attribute to a node that is not an element;
|
||||||
@ -702,7 +702,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
targetElem = ctxt->insert;
|
targetElem = ctxt->insert;
|
||||||
if (targetElem->type != XML_ELEMENT_NODE)
|
if (targetElem->type != XML_ELEMENT_NODE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SPEC XSLT 1.0:
|
* SPEC XSLT 1.0:
|
||||||
* "Adding an attribute to an element after children have been added
|
* "Adding an attribute to an element after children have been added
|
||||||
@ -728,7 +728,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
/*
|
/*
|
||||||
* Process the name
|
* Process the name
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WITH_DEBUGGER
|
#ifdef WITH_DEBUGGER
|
||||||
if (ctxt->debugStatus != XSLT_DEBUG_NONE)
|
if (ctxt->debugStatus != XSLT_DEBUG_NONE)
|
||||||
@ -774,7 +774,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
name = xsltSplitQName(ctxt->dict, comp->name, &prefix);
|
name = xsltSplitQName(ctxt->dict, comp->name, &prefix);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process namespace semantics
|
* Process namespace semantics
|
||||||
* ---------------------------
|
* ---------------------------
|
||||||
@ -798,9 +798,9 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
*/
|
*/
|
||||||
/* TODO: check attr acquisition wrt to the XSLT namespace */
|
/* TODO: check attr acquisition wrt to the XSLT namespace */
|
||||||
tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst,
|
tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst,
|
||||||
(const xmlChar *) "namespace", XSLT_NAMESPACE);
|
(const xmlChar *) "namespace", XSLT_NAMESPACE);
|
||||||
/*
|
/*
|
||||||
* This fixes bug #302020: The AVT might also evaluate to the
|
* This fixes bug #302020: The AVT might also evaluate to the
|
||||||
* empty string; this means that the empty string also indicates
|
* empty string; this means that the empty string also indicates
|
||||||
* "no namespace".
|
* "no namespace".
|
||||||
* SPEC XSLT 1.0:
|
* SPEC XSLT 1.0:
|
||||||
@ -809,7 +809,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
*/
|
*/
|
||||||
if ((tmpNsName != NULL) && (tmpNsName[0] != 0))
|
if ((tmpNsName != NULL) && (tmpNsName[0] != 0))
|
||||||
nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1);
|
nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1);
|
||||||
xmlFree(tmpNsName);
|
xmlFree(tmpNsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) {
|
if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) {
|
||||||
@ -830,7 +830,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
* expanded into an expanded-name using the namespace declarations
|
* expanded into an expanded-name using the namespace declarations
|
||||||
* in effect for the xsl:attribute element, *not* including any
|
* in effect for the xsl:attribute element, *not* including any
|
||||||
* default namespace declaration."
|
* default namespace declaration."
|
||||||
*/
|
*/
|
||||||
ns = xmlSearchNs(inst->doc, inst, prefix);
|
ns = xmlSearchNs(inst->doc, inst, prefix);
|
||||||
if (ns == NULL) {
|
if (ns == NULL) {
|
||||||
/*
|
/*
|
||||||
@ -843,7 +843,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
"this is an error, since the namespace was not "
|
"this is an error, since the namespace was not "
|
||||||
"specified by the instruction itself.\n", prefix, name);
|
"specified by the instruction itself.\n", prefix, name);
|
||||||
} else
|
} else
|
||||||
nsName = ns->href;
|
nsName = ns->href;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromAttributeSet) {
|
if (fromAttributeSet) {
|
||||||
@ -863,9 +863,9 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
* Find/create a matching ns-decl in the result tree.
|
* Find/create a matching ns-decl in the result tree.
|
||||||
*/
|
*/
|
||||||
ns = NULL;
|
ns = NULL;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (0) {
|
if (0) {
|
||||||
/*
|
/*
|
||||||
* OPTIMIZE TODO: How do we know if we are adding to a
|
* OPTIMIZE TODO: How do we know if we are adding to a
|
||||||
* fragment or to the result tree?
|
* fragment or to the result tree?
|
||||||
@ -884,7 +884,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (nsName != NULL) {
|
if (nsName != NULL) {
|
||||||
/*
|
/*
|
||||||
* Something about ns-prefixes:
|
* Something about ns-prefixes:
|
||||||
* SPEC XSLT 1.0:
|
* SPEC XSLT 1.0:
|
||||||
@ -925,12 +925,12 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
* TODO: Do we need to put the empty string in ?
|
* TODO: Do we need to put the empty string in ?
|
||||||
*/
|
*/
|
||||||
attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) "");
|
attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) "");
|
||||||
} else if ((inst->children->next == NULL) &&
|
} else if ((inst->children->next == NULL) &&
|
||||||
((inst->children->type == XML_TEXT_NODE) ||
|
((inst->children->type == XML_TEXT_NODE) ||
|
||||||
(inst->children->type == XML_CDATA_SECTION_NODE)))
|
(inst->children->type == XML_CDATA_SECTION_NODE)))
|
||||||
{
|
{
|
||||||
xmlNodePtr copyTxt;
|
xmlNodePtr copyTxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xmlSetNsProp() will take care of duplicates.
|
* xmlSetNsProp() will take care of duplicates.
|
||||||
*/
|
*/
|
||||||
@ -965,7 +965,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
*/
|
*/
|
||||||
copyTxt = xmlNewText(inst->children->content);
|
copyTxt = xmlNewText(inst->children->content);
|
||||||
if (copyTxt == NULL) /* TODO: report error */
|
if (copyTxt == NULL) /* TODO: report error */
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
attr->children = attr->last = copyTxt;
|
attr->children = attr->last = copyTxt;
|
||||||
copyTxt->parent = (xmlNodePtr) attr;
|
copyTxt->parent = (xmlNodePtr) attr;
|
||||||
@ -976,7 +976,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
* anyway?
|
* anyway?
|
||||||
*/
|
*/
|
||||||
if (inst->children->name == xmlStringTextNoenc)
|
if (inst->children->name == xmlStringTextNoenc)
|
||||||
copyTxt->name = xmlStringTextNoenc;
|
copyTxt->name = xmlStringTextNoenc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* since we create the attribute without content IDness must be
|
* since we create the attribute without content IDness must be
|
||||||
@ -1005,7 +1005,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1041,10 +1041,10 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
const xmlChar *attrSets)
|
const xmlChar *attrSets)
|
||||||
{
|
{
|
||||||
const xmlChar *ncname = NULL;
|
const xmlChar *ncname = NULL;
|
||||||
const xmlChar *prefix = NULL;
|
const xmlChar *prefix = NULL;
|
||||||
const xmlChar *curstr, *endstr;
|
const xmlChar *curstr, *endstr;
|
||||||
xsltAttrElemPtr attrs;
|
xsltAttrElemPtr attrs;
|
||||||
xsltStylesheetPtr style;
|
xsltStylesheetPtr style;
|
||||||
|
|
||||||
if (attrSets == NULL) {
|
if (attrSets == NULL) {
|
||||||
if (inst == NULL)
|
if (inst == NULL)
|
||||||
@ -1056,7 +1056,7 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
if (inst->type == XML_ATTRIBUTE_NODE) {
|
if (inst->type == XML_ATTRIBUTE_NODE) {
|
||||||
if ( ((xmlAttrPtr) inst)->children != NULL)
|
if ( ((xmlAttrPtr) inst)->children != NULL)
|
||||||
attrSets = ((xmlAttrPtr) inst)->children->content;
|
attrSets = ((xmlAttrPtr) inst)->children->content;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (attrSets == NULL) {
|
if (attrSets == NULL) {
|
||||||
/*
|
/*
|
||||||
|
@ -21,14 +21,14 @@ extern "C" {
|
|||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseStylesheetAttributeSet (xsltStylesheetPtr style,
|
xsltParseStylesheetAttributeSet (xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeAttributeSetsHashes (xsltStylesheetPtr style);
|
xsltFreeAttributeSetsHashes (xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltApplyAttributeSet (xsltTransformContextPtr ctxt,
|
xsltApplyAttributeSet (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr inst,
|
xmlNodePtr inst,
|
||||||
const xmlChar *attributes);
|
const xmlChar *attributes);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style);
|
xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ static xsltAttrVTPtr
|
|||||||
xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) {
|
xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) {
|
||||||
if (avt->nb_seg >= avt->max_seg) {
|
if (avt->nb_seg >= avt->max_seg) {
|
||||||
avt = (xsltAttrVTPtr) xmlRealloc(avt, sizeof(xsltAttrVT) +
|
avt = (xsltAttrVTPtr) xmlRealloc(avt, sizeof(xsltAttrVT) +
|
||||||
avt->max_seg * sizeof(void *));
|
avt->max_seg * sizeof(void *));
|
||||||
if (avt == NULL) {
|
if (avt == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) {
|
|||||||
|
|
||||||
if ((style == NULL) || (attr == NULL) || (attr->children == NULL))
|
if ((style == NULL) || (attr == NULL) || (attr->children == NULL))
|
||||||
return;
|
return;
|
||||||
if ((attr->children->type != XML_TEXT_NODE) ||
|
if ((attr->children->type != XML_TEXT_NODE) ||
|
||||||
(attr->children->next != NULL)) {
|
(attr->children->next != NULL)) {
|
||||||
xsltTransformError(NULL, style, attr->parent,
|
xsltTransformError(NULL, style, attr->parent,
|
||||||
"Attribute '%s': The content is expected to be a single text "
|
"Attribute '%s': The content is expected to be a single text "
|
||||||
@ -248,7 +248,7 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) {
|
|||||||
/* Need to check for literal (bug539741) */
|
/* Need to check for literal (bug539741) */
|
||||||
if ((*cur == '\'') || (*cur == '"')) {
|
if ((*cur == '\'') || (*cur == '"')) {
|
||||||
char delim = *(cur++);
|
char delim = *(cur++);
|
||||||
while ((*cur != 0) && (*cur != delim))
|
while ((*cur != 0) && (*cur != delim))
|
||||||
cur++;
|
cur++;
|
||||||
if (*cur != 0)
|
if (*cur != 0)
|
||||||
cur++; /* skip the ending delimiter */
|
cur++; /* skip the ending delimiter */
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Hooks for the document loader *
|
* Hooks for the document loader *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,7 +116,7 @@ xsltDocLoaderFunc xsltDocDefaultLoader = xsltDocDefaultLoaderFunc;
|
|||||||
* Set the new function to load document, if NULL it resets it to the
|
* Set the new function to load document, if NULL it resets it to the
|
||||||
* default function.
|
* default function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
xsltSetLoaderFunc(xsltDocLoaderFunc f) {
|
xsltSetLoaderFunc(xsltDocLoaderFunc f) {
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
@ -140,7 +140,7 @@ xsltSetLoaderFunc(xsltDocLoaderFunc f) {
|
|||||||
*
|
*
|
||||||
* Returns a handler to the document
|
* Returns a handler to the document
|
||||||
*/
|
*/
|
||||||
xsltDocumentPtr
|
xsltDocumentPtr
|
||||||
xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) {
|
xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) {
|
||||||
xsltDocumentPtr cur;
|
xsltDocumentPtr cur;
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) {
|
|||||||
*
|
*
|
||||||
* Returns a handler to the document
|
* Returns a handler to the document
|
||||||
*/
|
*/
|
||||||
xsltDocumentPtr
|
xsltDocumentPtr
|
||||||
xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) {
|
xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) {
|
||||||
xsltDocumentPtr cur;
|
xsltDocumentPtr cur;
|
||||||
|
|
||||||
@ -204,15 +204,15 @@ xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) {
|
|||||||
*
|
*
|
||||||
* Frees the node-trees (and xsltDocument structures) of all
|
* Frees the node-trees (and xsltDocument structures) of all
|
||||||
* stylesheet-modules of the stylesheet-level represented by
|
* stylesheet-modules of the stylesheet-level represented by
|
||||||
* the given @style.
|
* the given @style.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltFreeStyleDocuments(xsltStylesheetPtr style) {
|
xsltFreeStyleDocuments(xsltStylesheetPtr style) {
|
||||||
xsltDocumentPtr doc, cur;
|
xsltDocumentPtr doc, cur;
|
||||||
#ifdef XSLT_REFACTORED_XSLT_NSCOMP
|
#ifdef XSLT_REFACTORED_XSLT_NSCOMP
|
||||||
xsltNsMapPtr nsMap;
|
xsltNsMapPtr nsMap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (style == NULL)
|
if (style == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -220,8 +220,8 @@ xsltFreeStyleDocuments(xsltStylesheetPtr style) {
|
|||||||
if (XSLT_HAS_INTERNAL_NSMAP(style))
|
if (XSLT_HAS_INTERNAL_NSMAP(style))
|
||||||
nsMap = XSLT_GET_INTERNAL_NSMAP(style);
|
nsMap = XSLT_GET_INTERNAL_NSMAP(style);
|
||||||
else
|
else
|
||||||
nsMap = NULL;
|
nsMap = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cur = style->docList;
|
cur = style->docList;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
@ -247,7 +247,7 @@ xsltFreeStyleDocuments(xsltStylesheetPtr style) {
|
|||||||
*
|
*
|
||||||
* Free up all the space used by the loaded documents
|
* Free up all the space used by the loaded documents
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltFreeDocuments(xsltTransformContextPtr ctxt) {
|
xsltFreeDocuments(xsltTransformContextPtr ctxt) {
|
||||||
xsltDocumentPtr doc, cur;
|
xsltDocumentPtr doc, cur;
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ xsltFreeDocuments(xsltTransformContextPtr ctxt) {
|
|||||||
*
|
*
|
||||||
* Returns the new xsltDocumentPtr or NULL in case of error
|
* Returns the new xsltDocumentPtr or NULL in case of error
|
||||||
*/
|
*/
|
||||||
xsltDocumentPtr
|
xsltDocumentPtr
|
||||||
xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||||
xsltDocumentPtr ret;
|
xsltDocumentPtr ret;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
@ -294,7 +294,7 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
*/
|
*/
|
||||||
if (ctxt->sec != NULL) {
|
if (ctxt->sec != NULL) {
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = xsltCheckRead(ctxt->sec, ctxt, URI);
|
res = xsltCheckRead(ctxt->sec, ctxt, URI);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
xsltTransformError(ctxt, NULL, NULL,
|
xsltTransformError(ctxt, NULL, NULL,
|
||||||
@ -355,7 +355,7 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
|||||||
*
|
*
|
||||||
* Returns the new xsltDocumentPtr or NULL in case of error
|
* Returns the new xsltDocumentPtr or NULL in case of error
|
||||||
*/
|
*/
|
||||||
xsltDocumentPtr
|
xsltDocumentPtr
|
||||||
xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
|
xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
|
||||||
xsltDocumentPtr ret;
|
xsltDocumentPtr ret;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
@ -20,26 +20,26 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||||
xsltNewDocument (xsltTransformContextPtr ctxt,
|
xsltNewDocument (xsltTransformContextPtr ctxt,
|
||||||
xmlDocPtr doc);
|
xmlDocPtr doc);
|
||||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||||
xsltLoadDocument (xsltTransformContextPtr ctxt,
|
xsltLoadDocument (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *URI);
|
const xmlChar *URI);
|
||||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||||
xsltFindDocument (xsltTransformContextPtr ctxt,
|
xsltFindDocument (xsltTransformContextPtr ctxt,
|
||||||
xmlDocPtr doc);
|
xmlDocPtr doc);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeDocuments (xsltTransformContextPtr ctxt);
|
xsltFreeDocuments (xsltTransformContextPtr ctxt);
|
||||||
|
|
||||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||||
xsltLoadStyleDocument (xsltStylesheetPtr style,
|
xsltLoadStyleDocument (xsltStylesheetPtr style,
|
||||||
const xmlChar *URI);
|
const xmlChar *URI);
|
||||||
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
XSLTPUBFUN xsltDocumentPtr XSLTCALL
|
||||||
xsltNewStyleDocument (xsltStylesheetPtr style,
|
xsltNewStyleDocument (xsltStylesheetPtr style,
|
||||||
xmlDocPtr doc);
|
xmlDocPtr doc);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeStyleDocuments (xsltStylesheetPtr style);
|
xsltFreeStyleDocuments (xsltStylesheetPtr style);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hooks for document loading
|
* Hooks for document loading
|
||||||
|
@ -44,9 +44,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Private Types and Globals *
|
* Private Types and Globals *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
typedef struct _xsltExtDef xsltExtDef;
|
typedef struct _xsltExtDef xsltExtDef;
|
||||||
@ -89,9 +89,9 @@ static xmlHashTablePtr xsltModuleHash = NULL;
|
|||||||
static xmlMutexPtr xsltExtMutex = NULL;
|
static xmlMutexPtr xsltExtMutex = NULL;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Type functions *
|
* Type functions *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,18 +302,18 @@ typedef void (*exsltRegisterFunction) (void);
|
|||||||
* @URI: the function or element namespace URI
|
* @URI: the function or element namespace URI
|
||||||
*
|
*
|
||||||
* Dynamically loads an extension plugin when available.
|
* Dynamically loads an extension plugin when available.
|
||||||
*
|
*
|
||||||
* The plugin name is derived from the URI by removing the
|
* The plugin name is derived from the URI by removing the
|
||||||
* initial protocol designation, e.g. "http://", then converting
|
* initial protocol designation, e.g. "http://", then converting
|
||||||
* the characters ".", "-", "/", and "\" into "_", the removing
|
* the characters ".", "-", "/", and "\" into "_", the removing
|
||||||
* any trailing "/", then concatenating LIBXML_MODULE_EXTENSION.
|
* any trailing "/", then concatenating LIBXML_MODULE_EXTENSION.
|
||||||
*
|
*
|
||||||
* Plugins are loaded from the directory specified by the
|
* Plugins are loaded from the directory specified by the
|
||||||
* environment variable LIBXSLT_PLUGINS_PATH, or if NULL,
|
* environment variable LIBXSLT_PLUGINS_PATH, or if NULL,
|
||||||
* by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at
|
* by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at
|
||||||
* compile time.
|
* compile time.
|
||||||
*
|
*
|
||||||
* Returns 0 if successful, -1 in case of error.
|
* Returns 0 if successful, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -391,7 +391,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"Attempting to load plugin: %s for URI: %s\n",
|
"Attempting to load plugin: %s for URI: %s\n",
|
||||||
module_filename, URI);
|
module_filename, URI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
|||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
#ifdef WITH_XSLT_DEBUG_EXTENSIONS
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
|
"xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
|
||||||
module_filename, regfunc_name);
|
module_filename, regfunc_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -463,9 +463,9 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI ATTRIBUTE_UNUSED)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* The stylesheet extension prefixes handling *
|
* The stylesheet extension prefixes handling *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ xsltFreeExts(xsltStylesheetPtr style)
|
|||||||
* @style: an XSLT stylesheet
|
* @style: an XSLT stylesheet
|
||||||
* @prefix: the prefix used (optional)
|
* @prefix: the prefix used (optional)
|
||||||
* @URI: the URI associated to the extension
|
* @URI: the URI associated to the extension
|
||||||
*
|
*
|
||||||
* Registers an extension namespace
|
* Registers an extension namespace
|
||||||
* This is called from xslt.c during compile-time.
|
* This is called from xslt.c during compile-time.
|
||||||
* The given prefix is not needed.
|
* The given prefix is not needed.
|
||||||
@ -567,9 +567,9 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* The extensions modules interfaces *
|
* The extensions modules interfaces *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -577,7 +577,7 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style,
|
|||||||
* @ctxt: an XSLT transformation context
|
* @ctxt: an XSLT transformation context
|
||||||
* @name: the name of the element
|
* @name: the name of the element
|
||||||
* @URI: the URI associated to the element
|
* @URI: the URI associated to the element
|
||||||
* @function: the actual implementation which should be called
|
* @function: the actual implementation which should be called
|
||||||
*
|
*
|
||||||
* Registers an extension function
|
* Registers an extension function
|
||||||
*
|
*
|
||||||
@ -611,7 +611,7 @@ xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name,
|
|||||||
* @ctxt: an XSLT transformation context
|
* @ctxt: an XSLT transformation context
|
||||||
* @name: the name of the element
|
* @name: the name of the element
|
||||||
* @URI: the URI associated to the element
|
* @URI: the URI associated to the element
|
||||||
* @function: the actual implementation which should be called
|
* @function: the actual implementation which should be called
|
||||||
*
|
*
|
||||||
* Registers an extension element
|
* Registers an extension element
|
||||||
*
|
*
|
||||||
@ -666,8 +666,8 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style,
|
|||||||
xsltExtDataPtr dataContainer;
|
xsltExtDataPtr dataContainer;
|
||||||
void *userData = NULL;
|
void *userData = NULL;
|
||||||
xsltExtModulePtr module;
|
xsltExtModulePtr module;
|
||||||
|
|
||||||
if ((style == NULL) || (URI == NULL))
|
if ((style == NULL) || (URI == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
if (xsltExtensionsHash == NULL) {
|
if (xsltExtensionsHash == NULL) {
|
||||||
@ -716,7 +716,7 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style,
|
|||||||
* Fire the initialization callback.
|
* Fire the initialization callback.
|
||||||
*/
|
*/
|
||||||
userData = module->styleInitFunc(style, URI);
|
userData = module->styleInitFunc(style, URI);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Store the user-data in the context of the given stylesheet.
|
* Store the user-data in the context of the given stylesheet.
|
||||||
*/
|
*/
|
||||||
@ -727,7 +727,7 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style,
|
|||||||
if (xmlHashAddEntry(style->extInfos, URI,
|
if (xmlHashAddEntry(style->extInfos, URI,
|
||||||
(void *) dataContainer) < 0)
|
(void *) dataContainer) < 0)
|
||||||
{
|
{
|
||||||
xsltTransformError(NULL, style, NULL,
|
xsltTransformError(NULL, style, NULL,
|
||||||
"Failed to register module '%s'.\n", URI);
|
"Failed to register module '%s'.\n", URI);
|
||||||
style->errors++;
|
style->errors++;
|
||||||
if (module->styleShutdownFunc)
|
if (module->styleShutdownFunc)
|
||||||
@ -762,7 +762,7 @@ xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI)
|
|||||||
(xsltExtensionsHash == NULL))
|
(xsltExtensionsHash == NULL))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
/*
|
/*
|
||||||
* This is intended for global storage, so only the main
|
* This is intended for global storage, so only the main
|
||||||
@ -838,7 +838,7 @@ xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
|
|||||||
*/
|
*/
|
||||||
if (dataContainer)
|
if (dataContainer)
|
||||||
return(dataContainer->extData);
|
return(dataContainer->extData);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataContainer =
|
dataContainer =
|
||||||
xsltStyleInitializeStylesheetModule(style, URI);
|
xsltStyleInitializeStylesheetModule(style, URI);
|
||||||
@ -1120,7 +1120,7 @@ xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style,
|
|||||||
*
|
*
|
||||||
* xmlHashRemoveEntry(style->extInfos, URI,
|
* xmlHashRemoveEntry(style->extInfos, URI,
|
||||||
* (xmlHashDeallocator) xsltFreeExtData);
|
* (xmlHashDeallocator) xsltFreeExtData);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1156,12 +1156,12 @@ xsltShutdownExts(xsltStylesheetPtr style)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI)
|
xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI)
|
||||||
{
|
{
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
if ((style == NULL) || (style->compCtxt == NULL) ||
|
if ((style == NULL) || (style->compCtxt == NULL) ||
|
||||||
(XSLT_CCTXT(style)->inode == NULL) ||
|
(XSLT_CCTXT(style)->inode == NULL) ||
|
||||||
(XSLT_CCTXT(style)->inode->extElemNs == NULL))
|
(XSLT_CCTXT(style)->inode->extElemNs == NULL))
|
||||||
return (0);
|
return (0);
|
||||||
/*
|
/*
|
||||||
* Lookup the extension namespaces registered
|
* Lookup the extension namespaces registered
|
||||||
* at the current node in the stylesheet's tree.
|
* at the current node in the stylesheet's tree.
|
||||||
@ -1175,7 +1175,7 @@ xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI)
|
|||||||
URI))
|
URI))
|
||||||
{
|
{
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -1950,15 +1950,15 @@ xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar * URI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Test module http://xmlsoft.org/XSLT/ *
|
* Test module http://xmlsoft.org/XSLT/ *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Test of the extension module API *
|
* Test of the extension module API *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static xmlChar *testData = NULL;
|
static xmlChar *testData = NULL;
|
||||||
|
@ -40,9 +40,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Handling of XSLT debugging *
|
* Handling of XSLT debugging *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,9 +112,9 @@ xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Classic extensions as described by M. Kay *
|
* Classic extensions as described by M. Kay *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,14 +178,14 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
time_t gmt, lmt;
|
time_t gmt, lmt;
|
||||||
struct tm gmt_tm;
|
struct tm gmt_tm;
|
||||||
struct tm *local_tm;
|
struct tm *local_tm;
|
||||||
|
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
||||||
"localTime() : invalid number of args %d\n", nargs);
|
"localTime() : invalid number of args %d\n", nargs);
|
||||||
ctxt->error = XPATH_INVALID_ARITY;
|
ctxt->error = XPATH_INVALID_ARITY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = valuePop(ctxt);
|
obj = valuePop(ctxt);
|
||||||
|
|
||||||
if (obj->type != XPATH_STRING) {
|
if (obj->type != XPATH_STRING) {
|
||||||
@ -195,7 +195,7 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
|
valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = (char *) obj->stringval;
|
str = (char *) obj->stringval;
|
||||||
|
|
||||||
/* str = "$Date$" */
|
/* str = "$Date$" */
|
||||||
|
@ -60,16 +60,16 @@ extern "C" {
|
|||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt,
|
xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltDebug (xsltTransformContextPtr ctxt,
|
xsltDebug (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr inst,
|
xmlNodePtr inst,
|
||||||
xsltStylePreCompPtr comp);
|
xsltStylePreCompPtr comp);
|
||||||
|
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltRegisterExtras (xsltTransformContextPtr ctxt);
|
xsltRegisterExtras (xsltTransformContextPtr ctxt);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltRegisterAllExtras (void);
|
xsltRegisterAllExtras (void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -118,16 +118,16 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
|
|||||||
"document() : internal error tctxt == NULL\n");
|
"document() : internal error tctxt == NULL\n");
|
||||||
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
|
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uri = xmlParseURI((const char *) URI);
|
uri = xmlParseURI((const char *) URI);
|
||||||
if (uri == NULL) {
|
if (uri == NULL) {
|
||||||
xsltTransformError(tctxt, NULL, NULL,
|
xsltTransformError(tctxt, NULL, NULL,
|
||||||
"document() : failed to parse URI\n");
|
"document() : failed to parse URI\n");
|
||||||
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
|
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check for and remove fragment identifier
|
* check for and remove fragment identifier
|
||||||
*/
|
*/
|
||||||
@ -141,12 +141,12 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
|
|||||||
} else
|
} else
|
||||||
idoc = xsltLoadDocument(tctxt, URI);
|
idoc = xsltLoadDocument(tctxt, URI);
|
||||||
xmlFreeURI(uri);
|
xmlFreeURI(uri);
|
||||||
|
|
||||||
if (idoc == NULL) {
|
if (idoc == NULL) {
|
||||||
if ((URI == NULL) ||
|
if ((URI == NULL) ||
|
||||||
(URI[0] == '#') ||
|
(URI[0] == '#') ||
|
||||||
((tctxt->style->doc != NULL) &&
|
((tctxt->style->doc != NULL) &&
|
||||||
(xmlStrEqual(tctxt->style->doc->URL, URI))))
|
(xmlStrEqual(tctxt->style->doc->URL, URI))))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This selects the stylesheet's doc itself.
|
* This selects the stylesheet's doc itself.
|
||||||
@ -167,7 +167,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
|
|||||||
valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc));
|
valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use XPointer of HTML location for fragment ID */
|
/* use XPointer of HTML location for fragment ID */
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
#ifdef LIBXML_XPTR_ENABLED
|
||||||
xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
|
xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
|
||||||
@ -180,11 +180,11 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
|
|||||||
resObj = xmlXPtrEval(fragment, xptrctxt);
|
resObj = xmlXPtrEval(fragment, xptrctxt);
|
||||||
xmlXPathFreeContext(xptrctxt);
|
xmlXPathFreeContext(xptrctxt);
|
||||||
#endif
|
#endif
|
||||||
xmlFree(fragment);
|
xmlFree(fragment);
|
||||||
|
|
||||||
if (resObj == NULL)
|
if (resObj == NULL)
|
||||||
goto out_fragment;
|
goto out_fragment;
|
||||||
|
|
||||||
switch (resObj->type) {
|
switch (resObj->type) {
|
||||||
case XPATH_NODESET:
|
case XPATH_NODESET:
|
||||||
break;
|
break;
|
||||||
@ -198,11 +198,11 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
|
|||||||
case XPATH_RANGE:
|
case XPATH_RANGE:
|
||||||
case XPATH_LOCATIONSET:
|
case XPATH_LOCATIONSET:
|
||||||
xsltTransformError(tctxt, NULL, NULL,
|
xsltTransformError(tctxt, NULL, NULL,
|
||||||
"document() : XPointer does not select a node set: #%s\n",
|
"document() : XPointer does not select a node set: #%s\n",
|
||||||
fragment);
|
fragment);
|
||||||
goto out_object;
|
goto out_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
valuePush(ctxt, resObj);
|
valuePush(ctxt, resObj);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -355,15 +355,15 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
* node-set key(string, object)
|
* node-set key(string, object)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
||||||
xmlXPathObjectPtr obj1, obj2;
|
xmlXPathObjectPtr obj1, obj2;
|
||||||
|
|
||||||
if (nargs != 2) {
|
if (nargs != 2) {
|
||||||
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
||||||
"key() : expects two arguments\n");
|
"key() : expects two arguments\n");
|
||||||
ctxt->error = XPATH_INVALID_ARITY;
|
ctxt->error = XPATH_INVALID_ARITY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the key's value.
|
* Get the key's value.
|
||||||
@ -382,7 +382,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
/*
|
/*
|
||||||
* Get the key's name.
|
* Get the key's name.
|
||||||
*/
|
*/
|
||||||
obj1 = valuePop(ctxt);
|
obj1 = valuePop(ctxt);
|
||||||
|
|
||||||
if ((obj2->type == XPATH_NODESET) || (obj2->type == XPATH_XSLT_TREE)) {
|
if ((obj2->type == XPATH_NODESET) || (obj2->type == XPATH_XSLT_TREE)) {
|
||||||
int i;
|
int i;
|
||||||
@ -408,7 +408,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
xmlNodeSetPtr nodelist = NULL;
|
xmlNodeSetPtr nodelist = NULL;
|
||||||
xmlChar *key = NULL, *value;
|
xmlChar *key = NULL, *value;
|
||||||
const xmlChar *keyURI;
|
const xmlChar *keyURI;
|
||||||
xsltTransformContextPtr tctxt;
|
xsltTransformContextPtr tctxt;
|
||||||
xmlChar *qname, *prefix;
|
xmlChar *qname, *prefix;
|
||||||
xmlXPathContextPtr xpctxt = ctxt->context;
|
xmlXPathContextPtr xpctxt = ctxt->context;
|
||||||
xmlNodePtr tmpNode = NULL;
|
xmlNodePtr tmpNode = NULL;
|
||||||
@ -424,7 +424,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
"The context node is not set on the XPath context.\n");
|
"The context node is not set on the XPath context.\n");
|
||||||
tctxt->state = XSLT_STATE_STOPPED;
|
tctxt->state = XSLT_STATE_STOPPED;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Get the associated namespace URI if qualified name
|
* Get the associated namespace URI if qualified name
|
||||||
*/
|
*/
|
||||||
@ -464,7 +464,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
}
|
}
|
||||||
obj2 = valuePop(ctxt);
|
obj2 = valuePop(ctxt);
|
||||||
value = obj2->stringval;
|
value = obj2->stringval;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to ensure that ctxt->document is available for
|
* We need to ensure that ctxt->document is available for
|
||||||
* xsltGetKey().
|
* xsltGetKey().
|
||||||
@ -474,7 +474,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
* or the doc might be a Result Tree Fragment.
|
* or the doc might be a Result Tree Fragment.
|
||||||
* FUTURE INFO: In XSLT 2.0 the key() function takes an additional
|
* FUTURE INFO: In XSLT 2.0 the key() function takes an additional
|
||||||
* argument indicating the doc to use.
|
* argument indicating the doc to use.
|
||||||
*/
|
*/
|
||||||
if (xpctxt->node->type == XML_NAMESPACE_DECL) {
|
if (xpctxt->node->type == XML_NAMESPACE_DECL) {
|
||||||
/*
|
/*
|
||||||
* REVISIT: This is a libxml hack! Check xpath.c for details.
|
* REVISIT: This is a libxml hack! Check xpath.c for details.
|
||||||
@ -498,7 +498,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
|
|
||||||
if ((tctxt->document == NULL) ||
|
if ((tctxt->document == NULL) ||
|
||||||
(tctxt->document->doc != tmpNode->doc))
|
(tctxt->document->doc != tmpNode->doc))
|
||||||
{
|
{
|
||||||
if (tmpNode->doc->name && (tmpNode->doc->name[0] == ' ')) {
|
if (tmpNode->doc->name && (tmpNode->doc->name[0] == ' ')) {
|
||||||
/*
|
/*
|
||||||
* This is a Result Tree Fragment.
|
* This is a Result Tree Fragment.
|
||||||
@ -508,7 +508,7 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
if (tmpNode->doc->_private == NULL)
|
if (tmpNode->doc->_private == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private;
|
tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* May be the initial source doc or a doc acquired via the
|
* May be the initial source doc or a doc acquired via the
|
||||||
@ -529,18 +529,18 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
*/
|
*/
|
||||||
nodelist = xsltGetKey(tctxt, key, keyURI, value);
|
nodelist = xsltGetKey(tctxt, key, keyURI, value);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
tctxt->document = oldDocInfo;
|
tctxt->document = oldDocInfo;
|
||||||
valuePush(ctxt, xmlXPathWrapNodeSet(
|
valuePush(ctxt, xmlXPathWrapNodeSet(
|
||||||
xmlXPathNodeSetMerge(NULL, nodelist)));
|
xmlXPathNodeSetMerge(NULL, nodelist)));
|
||||||
if (key != NULL)
|
if (key != NULL)
|
||||||
xmlFree(key);
|
xmlFree(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj1 != NULL)
|
if (obj1 != NULL)
|
||||||
xmlXPathFreeObject(obj1);
|
xmlXPathFreeObject(obj1);
|
||||||
if (obj2 != NULL)
|
if (obj2 != NULL)
|
||||||
xmlXPathFreeObject(obj2);
|
xmlXPathFreeObject(obj2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -612,7 +612,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
if (sheet == NULL)
|
if (sheet == NULL)
|
||||||
return;
|
return;
|
||||||
formatValues = sheet->decimalFormat;
|
formatValues = sheet->decimalFormat;
|
||||||
|
|
||||||
switch (nargs) {
|
switch (nargs) {
|
||||||
case 3:
|
case 3:
|
||||||
CAST_TO_STRING;
|
CAST_TO_STRING;
|
||||||
@ -620,7 +620,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
|||||||
formatValues = xsltDecimalFormatGetByName(sheet, decimalObj->stringval);
|
formatValues = xsltDecimalFormatGetByName(sheet, decimalObj->stringval);
|
||||||
if (formatValues == NULL) {
|
if (formatValues == NULL) {
|
||||||
xsltTransformError(tctxt, NULL, NULL,
|
xsltTransformError(tctxt, NULL, NULL,
|
||||||
"format-number() : undeclared decimal format '%s'\n",
|
"format-number() : undeclared decimal format '%s'\n",
|
||||||
decimalObj->stringval);
|
decimalObj->stringval);
|
||||||
}
|
}
|
||||||
/* Intentional fall-through */
|
/* Intentional fall-through */
|
||||||
@ -967,9 +967,9 @@ xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Registration of XSLT and libxslt functions *
|
* Registration of XSLT and libxslt functions *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,28 +38,28 @@ XSLTPUBFUN xmlXPathFunction XSLTCALL
|
|||||||
* Interfaces for the functions implementations.
|
* Interfaces for the functions implementations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltDocumentFunction (xmlXPathParserContextPtr ctxt,
|
xsltDocumentFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltKeyFunction (xmlXPathParserContextPtr ctxt,
|
xsltKeyFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt,
|
xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt,
|
xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt,
|
xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt,
|
xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt,
|
xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt,
|
xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt,
|
||||||
int nargs);
|
int nargs);
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
* And the registration
|
* And the registration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
xsltRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -59,10 +59,10 @@
|
|||||||
* @style: the stylesheet being imported by the master
|
* @style: the stylesheet being imported by the master
|
||||||
*
|
*
|
||||||
* normalize the comp steps for the stylesheet being imported
|
* normalize the comp steps for the stylesheet being imported
|
||||||
* by the master, together with any imports within that.
|
* by the master, together with any imports within that.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void xsltFixImportedCompSteps(xsltStylesheetPtr master,
|
static void xsltFixImportedCompSteps(xsltStylesheetPtr master,
|
||||||
xsltStylesheetPtr style) {
|
xsltStylesheetPtr style) {
|
||||||
xsltStylesheetPtr res;
|
xsltStylesheetPtr res;
|
||||||
xmlHashScan(style->templatesHash,
|
xmlHashScan(style->templatesHash,
|
||||||
@ -230,7 +230,7 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
"xsl:include : unable to load %s\n", URI);
|
"xsl:include : unable to load %s\n", URI);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) {
|
if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) {
|
||||||
((xsltStyleItemIncludePtr) cur->psvi)->include = include;
|
((xsltStyleItemIncludePtr) cur->psvi)->include = include;
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,21 +48,21 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Module interfaces
|
* Module interfaces
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltParseStylesheetImport(xsltStylesheetPtr style,
|
xsltParseStylesheetImport(xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltParseStylesheetInclude
|
xsltParseStylesheetInclude
|
||||||
(xsltStylesheetPtr style,
|
(xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltNextImport (xsltStylesheetPtr style);
|
xsltNextImport (xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt);
|
xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt,
|
xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
XSLTPUBFUN xsltTemplatePtr XSLTCALL
|
XSLTPUBFUN xsltTemplatePtr XSLTCALL
|
||||||
xsltFindTemplate (xsltTransformContextPtr ctxt,
|
xsltFindTemplate (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *nameURI);
|
const xmlChar *nameURI);
|
||||||
|
@ -38,9 +38,9 @@ xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name,
|
|||||||
const xmlChar *nameURI);
|
const xmlChar *nameURI);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Type functions *
|
* Type functions *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +159,7 @@ xsltFreeKeyTable(xsltKeyTablePtr keyt) {
|
|||||||
if (keyt->nameURI != NULL)
|
if (keyt->nameURI != NULL)
|
||||||
xmlFree(keyt->nameURI);
|
xmlFree(keyt->nameURI);
|
||||||
if (keyt->keys != NULL)
|
if (keyt->keys != NULL)
|
||||||
xmlHashFree(keyt->keys,
|
xmlHashFree(keyt->keys,
|
||||||
(xmlHashDeallocator) xmlXPathFreeNodeSet);
|
(xmlHashDeallocator) xmlXPathFreeNodeSet);
|
||||||
memset(keyt, -1, sizeof(xsltKeyTable));
|
memset(keyt, -1, sizeof(xsltKeyTable));
|
||||||
xmlFree(keyt);
|
xmlFree(keyt);
|
||||||
@ -183,9 +183,9 @@ xsltFreeKeyTableList(xsltKeyTablePtr keyt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* The interpreter for the precompiled patterns *
|
* The interpreter for the precompiled patterns *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,17 +32,17 @@ XSLTPUBFUN int XSLTCALL
|
|||||||
const xmlChar *match,
|
const xmlChar *match,
|
||||||
const xmlChar *use,
|
const xmlChar *use,
|
||||||
xmlNodePtr inst);
|
xmlNodePtr inst);
|
||||||
XSLTPUBFUN xmlNodeSetPtr XSLTCALL
|
XSLTPUBFUN xmlNodeSetPtr XSLTCALL
|
||||||
xsltGetKey (xsltTransformContextPtr ctxt,
|
xsltGetKey (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *nameURI,
|
const xmlChar *nameURI,
|
||||||
const xmlChar *value);
|
const xmlChar *value);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltInitCtxtKeys (xsltTransformContextPtr ctxt,
|
xsltInitCtxtKeys (xsltTransformContextPtr ctxt,
|
||||||
xsltDocumentPtr doc);
|
xsltDocumentPtr doc);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeKeys (xsltStylesheetPtr style);
|
xsltFreeKeys (xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeDocumentKeys (xsltDocumentPtr doc);
|
xsltFreeDocumentKeys (xsltDocumentPtr doc);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
|
#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC
|
||||||
#define LIBXSLT_PUBLIC __declspec(dllimport)
|
#define LIBXSLT_PUBLIC __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define LIBXSLT_PUBLIC
|
#define LIBXSLT_PUBLIC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
static xsltNsAliasPtr
|
static xsltNsAliasPtr
|
||||||
xsltNewNsAlias(xsltCompilerCtxtPtr cctxt)
|
xsltNewNsAlias(xsltCompilerCtxtPtr cctxt)
|
||||||
{
|
{
|
||||||
@ -71,12 +71,12 @@ xsltNewNsAlias(xsltCompilerCtxtPtr cctxt)
|
|||||||
cctxt->style->errors++;
|
cctxt->style->errors++;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(xsltNsAlias));
|
memset(ret, 0, sizeof(xsltNsAlias));
|
||||||
/*
|
/*
|
||||||
* TODO: Store the item at current stylesheet-level.
|
* TODO: Store the item at current stylesheet-level.
|
||||||
*/
|
*/
|
||||||
ret->next = cctxt->nsAliases;
|
ret->next = cctxt->nsAliases;
|
||||||
cctxt->nsAliases = ret;
|
cctxt->nsAliases = ret;
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@ -96,8 +96,8 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
xmlChar *stylePrefix = NULL;
|
xmlChar *stylePrefix = NULL;
|
||||||
xmlNsPtr literalNs = NULL;
|
xmlNsPtr literalNs = NULL;
|
||||||
xmlNsPtr targetNs = NULL;
|
xmlNsPtr targetNs = NULL;
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
xsltNsAliasPtr alias;
|
xsltNsAliasPtr alias;
|
||||||
|
|
||||||
if ((style == NULL) || (node == NULL))
|
if ((style == NULL) || (node == NULL))
|
||||||
@ -118,9 +118,9 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
/*
|
/*
|
||||||
* NOTE that the XSLT 2.0 also *does* use the NULL namespace if
|
* NOTE that the XSLT 2.0 also *does* use the NULL namespace if
|
||||||
* "#default" is used and there's no default namespace is scope.
|
* "#default" is used and there's no default namespace is scope.
|
||||||
* I.e., this is *not* an error.
|
* I.e., this is *not* an error.
|
||||||
* Most XSLT 1.0 implementations work this way.
|
* Most XSLT 1.0 implementations work this way.
|
||||||
* The XSLT 1.0 spec has nothing to say on the subject.
|
* The XSLT 1.0 spec has nothing to say on the subject.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Attribute "stylesheet-prefix".
|
* Attribute "stylesheet-prefix".
|
||||||
@ -132,7 +132,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default"))
|
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default"))
|
||||||
literalNs = xmlSearchNs(node->doc, node, NULL);
|
literalNs = xmlSearchNs(node->doc, node, NULL);
|
||||||
else {
|
else {
|
||||||
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
|
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
|
||||||
if (literalNs == NULL) {
|
if (literalNs == NULL) {
|
||||||
@ -151,7 +151,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
xsltTransformError(NULL, style, node,
|
xsltTransformError(NULL, style, node,
|
||||||
"The attribute 'result-prefix' is missing.\n");
|
"The attribute 'result-prefix' is missing.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default"))
|
if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default"))
|
||||||
targetNs = xmlSearchNs(node->doc, node, NULL);
|
targetNs = xmlSearchNs(node->doc, node, NULL);
|
||||||
else {
|
else {
|
||||||
@ -197,8 +197,8 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
* result-prefix="foo"/>
|
* result-prefix="foo"/>
|
||||||
* From no namespace to namespace.
|
* From no namespace to namespace.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store the ns-node in the alias-object.
|
* Store the ns-node in the alias-object.
|
||||||
*/
|
*/
|
||||||
@ -213,7 +213,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
#else /* XSLT_REFACTORED */
|
#else /* XSLT_REFACTORED */
|
||||||
const xmlChar *literalNsName;
|
const xmlChar *literalNsName;
|
||||||
const xmlChar *targetNsName;
|
const xmlChar *targetNsName;
|
||||||
|
|
||||||
|
|
||||||
if ((style == NULL) || (node == NULL))
|
if ((style == NULL) || (node == NULL))
|
||||||
return;
|
return;
|
||||||
@ -230,7 +230,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
"namespace-alias: result-prefix attribute missing\n");
|
"namespace-alias: result-prefix attribute missing\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) {
|
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) {
|
||||||
literalNs = xmlSearchNs(node->doc, node, NULL);
|
literalNs = xmlSearchNs(node->doc, node, NULL);
|
||||||
if (literalNs == NULL) {
|
if (literalNs == NULL) {
|
||||||
@ -239,7 +239,7 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
literalNsName = literalNs->href; /* Yes - set for nsAlias table */
|
literalNsName = literalNs->href; /* Yes - set for nsAlias table */
|
||||||
} else {
|
} else {
|
||||||
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
|
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
|
||||||
|
|
||||||
if ((literalNs == NULL) || (literalNs->href == NULL)) {
|
if ((literalNs == NULL) || (literalNs->href == NULL)) {
|
||||||
xsltTransformError(NULL, style, node,
|
xsltTransformError(NULL, style, node,
|
||||||
"namespace-alias: prefix %s not bound to any namespace\n",
|
"namespace-alias: prefix %s not bound to any namespace\n",
|
||||||
@ -275,13 +275,13 @@ xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
|
|||||||
* Special case: if #default is used for
|
* Special case: if #default is used for
|
||||||
* the stylesheet-prefix (literal namespace) and there's no default
|
* the stylesheet-prefix (literal namespace) and there's no default
|
||||||
* namespace in scope, we'll use style->defaultAlias for this.
|
* namespace in scope, we'll use style->defaultAlias for this.
|
||||||
*/
|
*/
|
||||||
if (literalNsName == NULL) {
|
if (literalNsName == NULL) {
|
||||||
if (targetNs != NULL) {
|
if (targetNs != NULL) {
|
||||||
/*
|
/*
|
||||||
* BUG TODO: Is it not sufficient to have only 1 field for
|
* BUG TODO: Is it not sufficient to have only 1 field for
|
||||||
* this, since subsequently alias declarations will
|
* this, since subsequently alias declarations will
|
||||||
* overwrite this.
|
* overwrite this.
|
||||||
* Example:
|
* Example:
|
||||||
* <xsl:namespace-alias result-prefix="foo"
|
* <xsl:namespace-alias result-prefix="foo"
|
||||||
* stylesheet-prefix="#default"/>
|
* stylesheet-prefix="#default"/>
|
||||||
@ -358,7 +358,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
/*
|
/*
|
||||||
* OPTIMIZE TODO: This all could be optimized by keeping track of
|
* OPTIMIZE TODO: This all could be optimized by keeping track of
|
||||||
* the ns-decls currently in-scope via a specialized context.
|
* the ns-decls currently in-scope via a specialized context.
|
||||||
*/
|
*/
|
||||||
if ((nsPrefix == NULL) && ((nsName == NULL) || (nsName[0] == 0))) {
|
if ((nsPrefix == NULL) && ((nsName == NULL) || (nsName[0] == 0))) {
|
||||||
/*
|
/*
|
||||||
* NOTE: the "undeclaration" of the default namespace was
|
* NOTE: the "undeclaration" of the default namespace was
|
||||||
@ -398,7 +398,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
}
|
}
|
||||||
ns = ns->next;
|
ns = ns->next;
|
||||||
} while (ns != NULL);
|
} while (ns != NULL);
|
||||||
}
|
}
|
||||||
if ((target->parent != NULL) &&
|
if ((target->parent != NULL) &&
|
||||||
(target->parent->type == XML_ELEMENT_NODE))
|
(target->parent->type == XML_ELEMENT_NODE))
|
||||||
{
|
{
|
||||||
@ -408,7 +408,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
*/
|
*/
|
||||||
if (target->parent->ns == NULL)
|
if (target->parent->ns == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
ns = xmlSearchNs(target->doc, target->parent,
|
ns = xmlSearchNs(target->doc, target->parent,
|
||||||
NULL);
|
NULL);
|
||||||
/*
|
/*
|
||||||
@ -417,12 +417,12 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
*/
|
*/
|
||||||
if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0))
|
if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Undeclare the default namespace.
|
* Undeclare the default namespace.
|
||||||
*/
|
*/
|
||||||
xmlNewNs(target, BAD_CAST "", NULL);
|
xmlNewNs(target, BAD_CAST "", NULL);
|
||||||
/* TODO: Check result */
|
/* TODO: Check result */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -464,7 +464,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
* If the ns-prefix is occupied by an other ns-decl on the
|
* If the ns-prefix is occupied by an other ns-decl on the
|
||||||
* result element, then this means:
|
* result element, then this means:
|
||||||
* 1) The desired prefix is shadowed
|
* 1) The desired prefix is shadowed
|
||||||
* 2) There's no way around changing the prefix
|
* 2) There's no way around changing the prefix
|
||||||
*
|
*
|
||||||
* Try a desperate search for an in-scope ns-decl
|
* Try a desperate search for an in-scope ns-decl
|
||||||
* with a matching ns-name before we use the last option,
|
* with a matching ns-name before we use the last option,
|
||||||
@ -476,7 +476,7 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Fallback to changing the prefix.
|
* Fallback to changing the prefix.
|
||||||
*/
|
*/
|
||||||
} else if ((target->parent != NULL) &&
|
} else if ((target->parent != NULL) &&
|
||||||
(target->parent->type == XML_ELEMENT_NODE))
|
(target->parent->type == XML_ELEMENT_NODE))
|
||||||
{
|
{
|
||||||
@ -485,12 +485,12 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
*
|
*
|
||||||
* Check the common case: The parent element of the current
|
* Check the common case: The parent element of the current
|
||||||
* result element is in the same namespace (with an equal ns-prefix).
|
* result element is in the same namespace (with an equal ns-prefix).
|
||||||
*/
|
*/
|
||||||
if ((target->parent->ns != NULL) &&
|
if ((target->parent->ns != NULL) &&
|
||||||
((target->parent->ns->prefix != NULL) == (nsPrefix != NULL)))
|
((target->parent->ns->prefix != NULL) == (nsPrefix != NULL)))
|
||||||
{
|
{
|
||||||
ns = target->parent->ns;
|
ns = target->parent->ns;
|
||||||
|
|
||||||
if (nsPrefix == NULL) {
|
if (nsPrefix == NULL) {
|
||||||
if (xmlStrEqual(ns->href, nsName))
|
if (xmlStrEqual(ns->href, nsName))
|
||||||
return(ns);
|
return(ns);
|
||||||
@ -502,11 +502,11 @@ xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode,
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Lookup the remaining in-scope namespaces.
|
* Lookup the remaining in-scope namespaces.
|
||||||
*/
|
*/
|
||||||
ns = xmlSearchNs(target->doc, target->parent, nsPrefix);
|
ns = xmlSearchNs(target->doc, target->parent, nsPrefix);
|
||||||
if (ns != NULL) {
|
if (ns != NULL) {
|
||||||
if (xmlStrEqual(ns->href, nsName))
|
if (xmlStrEqual(ns->href, nsName))
|
||||||
return(ns);
|
return(ns);
|
||||||
/*
|
/*
|
||||||
* Now check for a nasty case: We need to ensure that the new
|
* Now check for a nasty case: We need to ensure that the new
|
||||||
* ns-decl won't shadow a prefix in-use by an existing attribute.
|
* ns-decl won't shadow a prefix in-use by an existing attribute.
|
||||||
@ -633,8 +633,8 @@ declare_new_prefix:
|
|||||||
xmlNsPtr
|
xmlNsPtr
|
||||||
xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
||||||
xmlNodePtr out)
|
xmlNodePtr out)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ns == NULL)
|
if (ns == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -657,15 +657,15 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
|||||||
style = ctxt->style;
|
style = ctxt->style;
|
||||||
while (style != NULL) {
|
while (style != NULL) {
|
||||||
if (style->nsAliases != NULL)
|
if (style->nsAliases != NULL)
|
||||||
URI = (const xmlChar *)
|
URI = (const xmlChar *)
|
||||||
xmlHashLookup(style->nsAliases, ns->href);
|
xmlHashLookup(style->nsAliases, ns->href);
|
||||||
if (URI != NULL)
|
if (URI != NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
style = xsltNextImport(style);
|
style = xsltNextImport(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (URI == UNDEFINED_DEFAULT_NS) {
|
if (URI == UNDEFINED_DEFAULT_NS) {
|
||||||
return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out));
|
return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out));
|
||||||
#if 0
|
#if 0
|
||||||
@ -674,7 +674,7 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
|||||||
* namespace in the stylesheet then this must resolve to
|
* namespace in the stylesheet then this must resolve to
|
||||||
* the NULL namespace.
|
* the NULL namespace.
|
||||||
*/
|
*/
|
||||||
xmlNsPtr dflt;
|
xmlNsPtr dflt;
|
||||||
dflt = xmlSearchNs(cur->doc, cur, NULL);
|
dflt = xmlSearchNs(cur->doc, cur, NULL);
|
||||||
if (dflt != NULL)
|
if (dflt != NULL)
|
||||||
URI = dflt->href;
|
URI = dflt->href;
|
||||||
@ -696,9 +696,9 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
|||||||
* @ns: the namespace
|
* @ns: the namespace
|
||||||
* @out: the result element
|
* @out: the result element
|
||||||
*
|
*
|
||||||
* Obsolete.
|
* Obsolete.
|
||||||
* *Not* called by any Libxslt/Libexslt function.
|
* *Not* called by any Libxslt/Libexslt function.
|
||||||
* Exaclty the same as xsltGetNamespace().
|
* Exaclty the same as xsltGetNamespace().
|
||||||
*
|
*
|
||||||
* Returns a namespace declaration or NULL in case of
|
* Returns a namespace declaration or NULL in case of
|
||||||
* namespace fixup failures or API or internal errors.
|
* namespace fixup failures or API or internal errors.
|
||||||
@ -706,7 +706,7 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
|
|||||||
xmlNsPtr
|
xmlNsPtr
|
||||||
xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,
|
xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,
|
||||||
xmlNsPtr ns, xmlNodePtr out)
|
xmlNsPtr ns, xmlNodePtr out)
|
||||||
{
|
{
|
||||||
return(xsltGetNamespace(ctxt, cur, ns, out));
|
return(xsltGetNamespace(ctxt, cur, ns, out));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur,
|
|||||||
* This function is intended only for *internal* use at
|
* This function is intended only for *internal* use at
|
||||||
* transformation-time for copying ns-declarations of Literal
|
* transformation-time for copying ns-declarations of Literal
|
||||||
* Result Elements.
|
* Result Elements.
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* xsltCopyTreeInternal() (transform.c)
|
* xsltCopyTreeInternal() (transform.c)
|
||||||
* xsltShallowCopyElem() (transform.c)
|
* xsltShallowCopyElem() (transform.c)
|
||||||
@ -735,7 +735,7 @@ xmlNsPtr
|
|||||||
xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||||
xmlNsPtr cur) {
|
xmlNsPtr cur) {
|
||||||
xmlNsPtr ret = NULL, tmp;
|
xmlNsPtr ret = NULL, tmp;
|
||||||
xmlNsPtr p = NULL,q;
|
xmlNsPtr p = NULL,q;
|
||||||
|
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -759,7 +759,7 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
if ((node->ns != NULL) &&
|
if ((node->ns != NULL) &&
|
||||||
(xmlStrEqual(node->ns->prefix, cur->prefix)) &&
|
(xmlStrEqual(node->ns->prefix, cur->prefix)) &&
|
||||||
(xmlStrEqual(node->ns->href, cur->href))) {
|
(xmlStrEqual(node->ns->href, cur->href))) {
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -824,7 +824,7 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
xmlNsPtr
|
xmlNsPtr
|
||||||
xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
|
xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||||
xmlNodePtr elem, xmlNsPtr ns)
|
xmlNodePtr elem, xmlNsPtr ns)
|
||||||
{
|
{
|
||||||
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
|
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
/*
|
/*
|
||||||
|
@ -32,31 +32,31 @@ extern "C" {
|
|||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltNamespaceAlias (xsltStylesheetPtr style,
|
xsltNamespaceAlias (xsltStylesheetPtr style,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||||
xsltGetNamespace (xsltTransformContextPtr ctxt,
|
xsltGetNamespace (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur,
|
xmlNodePtr cur,
|
||||||
xmlNsPtr ns,
|
xmlNsPtr ns,
|
||||||
xmlNodePtr out);
|
xmlNodePtr out);
|
||||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||||
xsltGetPlainNamespace (xsltTransformContextPtr ctxt,
|
xsltGetPlainNamespace (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur,
|
xmlNodePtr cur,
|
||||||
xmlNsPtr ns,
|
xmlNsPtr ns,
|
||||||
xmlNodePtr out);
|
xmlNodePtr out);
|
||||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||||
xsltGetSpecialNamespace (xsltTransformContextPtr ctxt,
|
xsltGetSpecialNamespace (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur,
|
xmlNodePtr cur,
|
||||||
const xmlChar *URI,
|
const xmlChar *URI,
|
||||||
const xmlChar *prefix,
|
const xmlChar *prefix,
|
||||||
xmlNodePtr out);
|
xmlNodePtr out);
|
||||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||||
xsltCopyNamespace (xsltTransformContextPtr ctxt,
|
xsltCopyNamespace (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr elem,
|
xmlNodePtr elem,
|
||||||
xmlNsPtr ns);
|
xmlNsPtr ns);
|
||||||
XSLTPUBFUN xmlNsPtr XSLTCALL
|
XSLTPUBFUN xmlNsPtr XSLTCALL
|
||||||
xsltCopyNamespaceList (xsltTransformContextPtr ctxt,
|
xsltCopyNamespaceList (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNsPtr cur);
|
xmlNsPtr cur);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeNamespaceAliasHashes
|
xsltFreeNamespaceAliasHashes
|
||||||
(xsltStylesheetPtr style);
|
(xsltStylesheetPtr style);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer,
|
|||||||
pointer -= groupingCharacterLen;
|
pointer -= groupingCharacterLen;
|
||||||
xmlCopyCharMultiByte(pointer, groupingCharacter);
|
xmlCopyCharMultiByte(pointer, groupingCharacter);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = digit_zero + (int)fmod(number, 10.0);
|
val = digit_zero + (int)fmod(number, 10.0);
|
||||||
if (val < 0x80) { /* shortcut if ASCII */
|
if (val < 0x80) { /* shortcut if ASCII */
|
||||||
if (pointer <= temp_string) { /* Check enough room */
|
if (pointer <= temp_string) { /* Check enough room */
|
||||||
@ -203,7 +203,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer,
|
|||||||
*(--pointer) = val;
|
*(--pointer) = val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
* Here we have a multibyte character. It's a little messy,
|
* Here we have a multibyte character. It's a little messy,
|
||||||
* because until we generate the char we don't know how long
|
* because until we generate the char we don't know how long
|
||||||
* it is. So, we generate it into the buffer temp_char, then
|
* it is. So, we generate it into the buffer temp_char, then
|
||||||
@ -241,7 +241,7 @@ xsltNumberFormatAlpha(xmlBufferPtr buffer,
|
|||||||
pointer = &temp_string[sizeof(temp_string)];
|
pointer = &temp_string[sizeof(temp_string)];
|
||||||
*(--pointer) = 0;
|
*(--pointer) = 0;
|
||||||
alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list;
|
alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list;
|
||||||
|
|
||||||
for (i = 1; i < (int)sizeof(temp_string); i++) {
|
for (i = 1; i < (int)sizeof(temp_string); i++) {
|
||||||
number--;
|
number--;
|
||||||
*(--pointer) = alpha_list[((int)fmod(number, alpha_size))];
|
*(--pointer) = alpha_list[((int)fmod(number, alpha_size))];
|
||||||
@ -337,7 +337,7 @@ xsltNumberFormatTokenize(const xmlChar *format,
|
|||||||
* 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 (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) ||
|
||||||
IS_DIGIT(val)) ) {
|
IS_DIGIT(val)) ) {
|
||||||
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;
|
||||||
@ -632,11 +632,11 @@ xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context,
|
|||||||
for (ancestor = node;
|
for (ancestor = node;
|
||||||
(ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE);
|
(ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE);
|
||||||
ancestor = xmlXPathNextAncestor(parser, ancestor)) {
|
ancestor = xmlXPathNextAncestor(parser, ancestor)) {
|
||||||
|
|
||||||
if ((fromPat != NULL) &&
|
if ((fromPat != NULL) &&
|
||||||
xsltTestCompMatchList(context, ancestor, fromPat))
|
xsltTestCompMatchList(context, ancestor, fromPat))
|
||||||
break; /* for */
|
break; /* for */
|
||||||
|
|
||||||
if ((countPat == NULL && node->type == ancestor->type &&
|
if ((countPat == NULL && node->type == ancestor->type &&
|
||||||
xmlStrEqual(node->name, ancestor->name)) ||
|
xmlStrEqual(node->name, ancestor->name)) ||
|
||||||
xsltTestCompMatchList(context, ancestor, countPat)) {
|
xsltTestCompMatchList(context, ancestor, countPat)) {
|
||||||
@ -644,7 +644,7 @@ xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context,
|
|||||||
cnt = 0;
|
cnt = 0;
|
||||||
for (preceding = ancestor;
|
for (preceding = ancestor;
|
||||||
preceding != NULL;
|
preceding != NULL;
|
||||||
preceding =
|
preceding =
|
||||||
xmlXPathNextPrecedingSibling(parser, preceding)) {
|
xmlXPathNextPrecedingSibling(parser, preceding)) {
|
||||||
if (countPat == NULL) {
|
if (countPat == NULL) {
|
||||||
if ((preceding->type == ancestor->type) &&
|
if ((preceding->type == ancestor->type) &&
|
||||||
@ -681,7 +681,7 @@ xsltNumberFormatGetValue(xmlXPathContextPtr context,
|
|||||||
int amount = 0;
|
int amount = 0;
|
||||||
xmlBufferPtr pattern;
|
xmlBufferPtr pattern;
|
||||||
xmlXPathObjectPtr obj;
|
xmlXPathObjectPtr obj;
|
||||||
|
|
||||||
pattern = xmlBufferCreate();
|
pattern = xmlBufferCreate();
|
||||||
if (pattern != NULL) {
|
if (pattern != NULL) {
|
||||||
xmlBufferCCat(pattern, "number(");
|
xmlBufferCCat(pattern, "number(");
|
||||||
@ -750,9 +750,9 @@ xsltNumberFormat(xsltTransformContextPtr ctxt,
|
|||||||
&tokens,
|
&tokens,
|
||||||
output);
|
output);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (data->level) {
|
} else if (data->level) {
|
||||||
|
|
||||||
if (xmlStrEqual(data->level, (const xmlChar *) "single")) {
|
if (xmlStrEqual(data->level, (const xmlChar *) "single")) {
|
||||||
amount = xsltNumberFormatGetMultipleLevel(ctxt,
|
amount = xsltNumberFormatGetMultipleLevel(ctxt,
|
||||||
node,
|
node,
|
||||||
@ -792,7 +792,7 @@ xsltNumberFormat(xsltTransformContextPtr ctxt,
|
|||||||
node,
|
node,
|
||||||
data->countPat,
|
data->countPat,
|
||||||
data->fromPat,
|
data->fromPat,
|
||||||
&number,
|
&number,
|
||||||
data->doc,
|
data->doc,
|
||||||
data->node);
|
data->node);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
@ -815,7 +815,7 @@ xsltNumberFormat(xsltTransformContextPtr ctxt,
|
|||||||
if (tokens.tokens[i].separator != NULL)
|
if (tokens.tokens[i].separator != NULL)
|
||||||
xmlFree(tokens.tokens[i].separator);
|
xmlFree(tokens.tokens[i].separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
XSLT_NUMBER_FORMAT_END:
|
XSLT_NUMBER_FORMAT_END:
|
||||||
if (tempformat == 1) {
|
if (tempformat == 1) {
|
||||||
/* The format need to be recomputed each time */
|
/* The format need to be recomputed each time */
|
||||||
@ -832,9 +832,9 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/*
|
/*
|
||||||
* prefix / suffix ends at end of string or at
|
* prefix / suffix ends at end of string or at
|
||||||
* first 'special' character
|
* first 'special' character
|
||||||
*/
|
*/
|
||||||
if (**format == 0)
|
if (**format == 0)
|
||||||
return count;
|
return count;
|
||||||
@ -847,12 +847,12 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma
|
|||||||
return count;
|
return count;
|
||||||
/*
|
/*
|
||||||
* else treat percent/per-mille as special cases,
|
* else treat percent/per-mille as special cases,
|
||||||
* depending on whether +ve or -ve
|
* depending on whether +ve or -ve
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
* for +ve prefix/suffix, allow only a
|
* for +ve prefix/suffix, allow only a
|
||||||
* single occurence of either
|
* single occurence of either
|
||||||
*/
|
*/
|
||||||
if (xsltUTF8Charcmp(*format, self->percent) == 0) {
|
if (xsltUTF8Charcmp(*format, self->percent) == 0) {
|
||||||
if (info->is_multiplier_set)
|
if (info->is_multiplier_set)
|
||||||
@ -866,14 +866,14 @@ xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltForma
|
|||||||
info->is_multiplier_set = TRUE;
|
info->is_multiplier_set = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((len=xsltUTF8Size(*format)) < 1)
|
if ((len=xsltUTF8Size(*format)) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
count += len;
|
count += len;
|
||||||
*format += len;
|
*format += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltFormatNumberConversion:
|
* xsltFormatNumberConversion:
|
||||||
* @self: the decimal format
|
* @self: the decimal format
|
||||||
@ -932,9 +932,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
int j, len;
|
int j, len;
|
||||||
int self_grouping_len;
|
int self_grouping_len;
|
||||||
xsltFormatNumberInfo format_info;
|
xsltFormatNumberInfo format_info;
|
||||||
/*
|
/*
|
||||||
* delayed_multiplier allows a 'trailing' percent or
|
* delayed_multiplier allows a 'trailing' percent or
|
||||||
* permille to be treated as suffix
|
* permille to be treated as suffix
|
||||||
*/
|
*/
|
||||||
int delayed_multiplier = 0;
|
int delayed_multiplier = 0;
|
||||||
/* flag to show no -ve format present for -ve number */
|
/* flag to show no -ve format present for -ve number */
|
||||||
@ -990,7 +990,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* First we process the +ve pattern to get percent / permille,
|
* First we process the +ve pattern to get percent / permille,
|
||||||
* as well as main format
|
* as well as main format
|
||||||
*/
|
*/
|
||||||
prefix = the_format;
|
prefix = the_format;
|
||||||
prefix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
|
prefix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
|
||||||
@ -999,18 +999,18 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
goto OUTPUT_NUMBER;
|
goto OUTPUT_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we process the "number" part of the format. It gets
|
* Here we process the "number" part of the format. It gets
|
||||||
* a little messy because of the percent/per-mille - if that
|
* a little messy because of the percent/per-mille - if that
|
||||||
* appears at the end, it may be part of the suffix instead
|
* appears at the end, it may be part of the suffix instead
|
||||||
* of part of the number, so the variable delayed_multiplier
|
* of part of the number, so the variable delayed_multiplier
|
||||||
* is used to handle it
|
* is used to handle it
|
||||||
*/
|
*/
|
||||||
self_grouping_len = xmlStrlen(self->grouping);
|
self_grouping_len = xmlStrlen(self->grouping);
|
||||||
while ((*the_format != 0) &&
|
while ((*the_format != 0) &&
|
||||||
(xsltUTF8Charcmp(the_format, self->decimalPoint) != 0) &&
|
(xsltUTF8Charcmp(the_format, self->decimalPoint) != 0) &&
|
||||||
(xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) {
|
(xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) {
|
||||||
|
|
||||||
if (delayed_multiplier != 0) {
|
if (delayed_multiplier != 0) {
|
||||||
format_info.multiplier = delayed_multiplier;
|
format_info.multiplier = delayed_multiplier;
|
||||||
format_info.is_multiplier_set = TRUE;
|
format_info.is_multiplier_set = TRUE;
|
||||||
@ -1048,7 +1048,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
delayed_multiplier = 1000;
|
delayed_multiplier = 1000;
|
||||||
} else
|
} else
|
||||||
break; /* while */
|
break; /* while */
|
||||||
|
|
||||||
if ((len=xsltUTF8Size(the_format)) < 1) {
|
if ((len=xsltUTF8Size(the_format)) < 1) {
|
||||||
found_error = 1;
|
found_error = 1;
|
||||||
goto OUTPUT_NUMBER;
|
goto OUTPUT_NUMBER;
|
||||||
@ -1062,9 +1062,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
format_info.add_decimal = TRUE;
|
format_info.add_decimal = TRUE;
|
||||||
the_format += xsltUTF8Size(the_format); /* Skip over the decimal */
|
the_format += xsltUTF8Size(the_format); /* Skip over the decimal */
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*the_format != 0) {
|
while (*the_format != 0) {
|
||||||
|
|
||||||
if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) {
|
if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) {
|
||||||
if (format_info.frac_hash != 0) {
|
if (format_info.frac_hash != 0) {
|
||||||
found_error = 1;
|
found_error = 1;
|
||||||
@ -1112,9 +1112,9 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If delayed_multiplier is set after processing the
|
* If delayed_multiplier is set after processing the
|
||||||
* "number" part, should be in suffix
|
* "number" part, should be in suffix
|
||||||
*/
|
*/
|
||||||
if (delayed_multiplier != 0) {
|
if (delayed_multiplier != 0) {
|
||||||
the_format -= len;
|
the_format -= len;
|
||||||
@ -1124,7 +1124,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
suffix = the_format;
|
suffix = the_format;
|
||||||
suffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
|
suffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info);
|
||||||
if ( (suffix_length < 0) ||
|
if ( (suffix_length < 0) ||
|
||||||
((*the_format != 0) &&
|
((*the_format != 0) &&
|
||||||
(xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) ) {
|
(xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) ) {
|
||||||
found_error = 1;
|
found_error = 1;
|
||||||
goto OUTPUT_NUMBER;
|
goto OUTPUT_NUMBER;
|
||||||
@ -1147,17 +1147,17 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
else {
|
else {
|
||||||
/* Skip over pattern separator (accounting for UTF8) */
|
/* Skip over pattern separator (accounting for UTF8) */
|
||||||
the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1);
|
the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1);
|
||||||
/*
|
/*
|
||||||
* Flag changes interpretation of percent/permille
|
* Flag changes interpretation of percent/permille
|
||||||
* in -ve pattern
|
* in -ve pattern
|
||||||
*/
|
*/
|
||||||
format_info.is_negative_pattern = TRUE;
|
format_info.is_negative_pattern = TRUE;
|
||||||
format_info.is_multiplier_set = FALSE;
|
format_info.is_multiplier_set = FALSE;
|
||||||
|
|
||||||
/* First do the -ve prefix */
|
/* First do the -ve prefix */
|
||||||
nprefix = the_format;
|
nprefix = the_format;
|
||||||
nprefix_length = xsltFormatNumberPreSuffix(self,
|
nprefix_length = xsltFormatNumberPreSuffix(self,
|
||||||
&the_format, &format_info);
|
&the_format, &format_info);
|
||||||
if (nprefix_length<0) {
|
if (nprefix_length<0) {
|
||||||
found_error = 1;
|
found_error = 1;
|
||||||
goto OUTPUT_NUMBER;
|
goto OUTPUT_NUMBER;
|
||||||
@ -1191,7 +1191,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
/* Finally do the -ve suffix */
|
/* Finally do the -ve suffix */
|
||||||
if (*the_format != 0) {
|
if (*the_format != 0) {
|
||||||
nsuffix = the_format;
|
nsuffix = the_format;
|
||||||
nsuffix_length = xsltFormatNumberPreSuffix(self,
|
nsuffix_length = xsltFormatNumberPreSuffix(self,
|
||||||
&the_format, &format_info);
|
&the_format, &format_info);
|
||||||
if (nsuffix_length < 0) {
|
if (nsuffix_length < 0) {
|
||||||
found_error = 1;
|
found_error = 1;
|
||||||
@ -1209,12 +1209,12 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
|||||||
* if -ve prefix/suffix == +ve ones, discard & use default
|
* if -ve prefix/suffix == +ve ones, discard & use default
|
||||||
*/
|
*/
|
||||||
if ((nprefix_length != prefix_length) ||
|
if ((nprefix_length != prefix_length) ||
|
||||||
(nsuffix_length != suffix_length) ||
|
(nsuffix_length != suffix_length) ||
|
||||||
((nprefix_length > 0) &&
|
((nprefix_length > 0) &&
|
||||||
(xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) ||
|
(xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) ||
|
||||||
((nsuffix_length > 0) &&
|
((nsuffix_length > 0) &&
|
||||||
(xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
|
(xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
|
||||||
prefix = nprefix;
|
prefix = nprefix;
|
||||||
prefix_length = nprefix_length;
|
prefix_length = nprefix_length;
|
||||||
suffix = nsuffix;
|
suffix = nsuffix;
|
||||||
suffix_length = nsuffix_length;
|
suffix_length = nsuffix_length;
|
||||||
@ -1260,9 +1260,9 @@ OUTPUT_NUMBER:
|
|||||||
number = fabs(number) * (double)format_info.multiplier;
|
number = fabs(number) * (double)format_info.multiplier;
|
||||||
scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash));
|
scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash));
|
||||||
number = floor((scale * number + 0.5)) / scale;
|
number = floor((scale * number + 0.5)) / scale;
|
||||||
if ((self->grouping != NULL) &&
|
if ((self->grouping != NULL) &&
|
||||||
(self->grouping[0] != 0)) {
|
(self->grouping[0] != 0)) {
|
||||||
|
|
||||||
len = xmlStrlen(self->grouping);
|
len = xmlStrlen(self->grouping);
|
||||||
pchar = xsltGetUTF8Char(self->grouping, &len);
|
pchar = xsltGetUTF8Char(self->grouping, &len);
|
||||||
xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
|
xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
|
||||||
@ -1291,14 +1291,14 @@ OUTPUT_NUMBER:
|
|||||||
/* Next the fractional part, if required */
|
/* Next the fractional part, if required */
|
||||||
if (format_info.frac_digits + format_info.frac_hash == 0) {
|
if (format_info.frac_digits + format_info.frac_hash == 0) {
|
||||||
if (format_info.add_decimal)
|
if (format_info.add_decimal)
|
||||||
xmlBufferAdd(buffer, self->decimalPoint,
|
xmlBufferAdd(buffer, self->decimalPoint,
|
||||||
xsltUTF8Size(self->decimalPoint));
|
xsltUTF8Size(self->decimalPoint));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
number -= floor(number);
|
number -= floor(number);
|
||||||
if ((number != 0) || (format_info.frac_digits != 0)) {
|
if ((number != 0) || (format_info.frac_digits != 0)) {
|
||||||
xmlBufferAdd(buffer, self->decimalPoint,
|
xmlBufferAdd(buffer, self->decimalPoint,
|
||||||
xsltUTF8Size(self->decimalPoint));
|
xsltUTF8Size(self->decimalPoint));
|
||||||
number = floor(scale * number + 0.5);
|
number = floor(scale * number + 0.5);
|
||||||
for (j = format_info.frac_hash; j > 0; j--) {
|
for (j = format_info.frac_hash; j > 0; j--) {
|
||||||
if (fmod(number, 10.0) >= 1.0)
|
if (fmod(number, 10.0) >= 1.0)
|
||||||
|
@ -26,7 +26,7 @@ struct _xsltCompMatch;
|
|||||||
*/
|
*/
|
||||||
typedef struct _xsltNumberData xsltNumberData;
|
typedef struct _xsltNumberData xsltNumberData;
|
||||||
typedef xsltNumberData *xsltNumberDataPtr;
|
typedef xsltNumberData *xsltNumberDataPtr;
|
||||||
|
|
||||||
struct _xsltNumberData {
|
struct _xsltNumberData {
|
||||||
const xmlChar *level;
|
const xmlChar *level;
|
||||||
const xmlChar *count;
|
const xmlChar *count;
|
||||||
|
@ -128,9 +128,9 @@ struct _xsltParserContext {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Type functions *
|
* Type functions *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,7 +373,7 @@ xsltSwapTopCompMatch(xsltCompMatchPtr comp) {
|
|||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
register xmlChar *tmp;
|
register xmlChar *tmp;
|
||||||
register xsltOp op;
|
register xsltOp op;
|
||||||
register xmlXPathCompExprPtr expr;
|
register xmlXPathCompExprPtr expr;
|
||||||
register int t;
|
register int t;
|
||||||
i = j - 1;
|
i = j - 1;
|
||||||
tmp = comp->steps[i].value;
|
tmp = comp->steps[i].value;
|
||||||
@ -474,9 +474,9 @@ xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* The interpreter for the precompiled patterns *
|
* The interpreter for the precompiled patterns *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -545,7 +545,7 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
|
|||||||
ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
|
ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
|
||||||
list = (xmlXPathObjectPtr)
|
list = (xmlXPathObjectPtr)
|
||||||
XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
|
XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
|
||||||
|
|
||||||
if ((list == NULL) || (prevdoc != doc)) {
|
if ((list == NULL) || (prevdoc != doc)) {
|
||||||
xmlXPathObjectPtr newlist;
|
xmlXPathObjectPtr newlist;
|
||||||
xmlNodePtr parent = node->parent;
|
xmlNodePtr parent = node->parent;
|
||||||
@ -581,7 +581,7 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
|
|||||||
|
|
||||||
if ((parent == NULL) || (node->doc == NULL) || isRVT)
|
if ((parent == NULL) || (node->doc == NULL) || isRVT)
|
||||||
nocache = 1;
|
nocache = 1;
|
||||||
|
|
||||||
if (nocache == 0) {
|
if (nocache == 0) {
|
||||||
if (list != NULL)
|
if (list != NULL)
|
||||||
xmlXPathFreeObject(list);
|
xmlXPathFreeObject(list);
|
||||||
@ -763,8 +763,8 @@ restart:
|
|||||||
if (step->op == XSLT_OP_ROOT)
|
if (step->op == XSLT_OP_ROOT)
|
||||||
goto found;
|
goto found;
|
||||||
/* added NS, ID and KEY as a result of bug 168208 */
|
/* added NS, ID and KEY as a result of bug 168208 */
|
||||||
if ((step->op != XSLT_OP_ELEM) &&
|
if ((step->op != XSLT_OP_ELEM) &&
|
||||||
(step->op != XSLT_OP_ALL) &&
|
(step->op != XSLT_OP_ALL) &&
|
||||||
(step->op != XSLT_OP_NS) &&
|
(step->op != XSLT_OP_NS) &&
|
||||||
(step->op != XSLT_OP_ID) &&
|
(step->op != XSLT_OP_ID) &&
|
||||||
(step->op != XSLT_OP_KEY))
|
(step->op != XSLT_OP_KEY))
|
||||||
@ -872,7 +872,7 @@ restart:
|
|||||||
xmlFree(states.states);
|
xmlFree(states.states);
|
||||||
}
|
}
|
||||||
return(xsltTestCompMatchDirect(ctxt, comp, node,
|
return(xsltTestCompMatchDirect(ctxt, comp, node,
|
||||||
comp->nsList, comp->nsNr));
|
comp->nsList, comp->nsNr));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc = node->doc;
|
doc = node->doc;
|
||||||
@ -1235,17 +1235,17 @@ xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
|||||||
#define NXT(val) ctxt->cur[(val)]
|
#define NXT(val) ctxt->cur[(val)]
|
||||||
#define CUR_PTR ctxt->cur
|
#define CUR_PTR ctxt->cur
|
||||||
|
|
||||||
#define SKIP_BLANKS \
|
#define SKIP_BLANKS \
|
||||||
while (IS_BLANK_CH(CUR)) NEXT
|
while (IS_BLANK_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)
|
||||||
|
|
||||||
|
|
||||||
#define PUSH(op, val, val2, novar) \
|
#define PUSH(op, val, val2, novar) \
|
||||||
if (xsltCompMatchAdd(ctxt, ctxt->comp, (op), (val), (val2), (novar))) goto error;
|
if (xsltCompMatchAdd(ctxt, ctxt->comp, (op), (val), (val2), (novar))) goto error;
|
||||||
|
|
||||||
#define SWAP() \
|
#define SWAP() \
|
||||||
xsltSwapTopCompMatch(ctxt->comp);
|
xsltSwapTopCompMatch(ctxt->comp);
|
||||||
|
|
||||||
#define XSLT_ERROR(X) \
|
#define XSLT_ERROR(X) \
|
||||||
@ -1533,7 +1533,7 @@ error:
|
|||||||
* Compile the XSLT StepPattern and generates a precompiled
|
* Compile the XSLT StepPattern and generates a precompiled
|
||||||
* form suitable for fast matching.
|
* form suitable for fast matching.
|
||||||
*
|
*
|
||||||
* [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate*
|
* [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate*
|
||||||
* [6] ChildOrAttributeAxisSpecifier ::= AbbreviatedAxisSpecifier
|
* [6] ChildOrAttributeAxisSpecifier ::= AbbreviatedAxisSpecifier
|
||||||
* | ('child' | 'attribute') '::'
|
* | ('child' | 'attribute') '::'
|
||||||
* from XPath
|
* from XPath
|
||||||
@ -2087,12 +2087,12 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur,
|
|||||||
pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
|
pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
|
||||||
style, NULL, 1);
|
style, NULL, 1);
|
||||||
if (pat == NULL)
|
if (pat == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
while (pat) {
|
while (pat) {
|
||||||
next = pat->next;
|
next = pat->next;
|
||||||
pat->next = NULL;
|
pat->next = NULL;
|
||||||
name = NULL;
|
name = NULL;
|
||||||
|
|
||||||
pat->template = cur;
|
pat->template = cur;
|
||||||
if (mode != NULL)
|
if (mode != NULL)
|
||||||
pat->mode = xmlDictLookup(style->dict, mode, -1);
|
pat->mode = xmlDictLookup(style->dict, mode, -1);
|
||||||
@ -2479,7 +2479,7 @@ keyed_match:
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case XML_ELEMENT_NODE:
|
case XML_ELEMENT_NODE:
|
||||||
if (node->psvi != NULL) keyed = 1;
|
if (node->psvi != NULL) keyed = 1;
|
||||||
break;
|
break;
|
||||||
case XML_ATTRIBUTE_NODE:
|
case XML_ATTRIBUTE_NODE:
|
||||||
@ -2488,13 +2488,13 @@ keyed_match:
|
|||||||
case XML_TEXT_NODE:
|
case XML_TEXT_NODE:
|
||||||
case XML_CDATA_SECTION_NODE:
|
case XML_CDATA_SECTION_NODE:
|
||||||
case XML_COMMENT_NODE:
|
case XML_COMMENT_NODE:
|
||||||
case XML_PI_NODE:
|
case XML_PI_NODE:
|
||||||
if (node->psvi != NULL) keyed = 1;
|
if (node->psvi != NULL) keyed = 1;
|
||||||
break;
|
break;
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
case XML_HTML_DOCUMENT_NODE:
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
|
if (((xmlDocPtr) node)->psvi != NULL) keyed = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) {
|
|||||||
xmlNodePtr parent;
|
xmlNodePtr parent;
|
||||||
if ((style == NULL) || (inst == NULL) || (inst->ns == NULL))
|
if ((style == NULL) || (inst == NULL) || (inst->ns == NULL))
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
parent = inst->parent;
|
parent = inst->parent;
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -116,7 +116,7 @@ xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
has_ext = (style->extInfos != NULL);
|
has_ext = (style->extInfos != NULL);
|
||||||
|
|
||||||
parent = inst->parent;
|
parent = inst->parent;
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
@ -142,7 +142,7 @@ xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
if ((has_ext) && (parent->ns != NULL) &&
|
if ((has_ext) && (parent->ns != NULL) &&
|
||||||
(xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
|
(xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
}
|
}
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
@ -194,7 +194,7 @@ xsltCheckParentElement(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
if ((parent->ns != NULL) &&
|
if ((parent->ns != NULL) &&
|
||||||
(xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
|
(xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) {
|
|||||||
|
|
||||||
if (style == NULL)
|
if (style == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
/*
|
/*
|
||||||
* URGENT TODO: Use specialized factory functions in order
|
* URGENT TODO: Use specialized factory functions in order
|
||||||
@ -281,7 +281,7 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) {
|
|||||||
size = sizeof(xsltStyleItemWhen); break;
|
size = sizeof(xsltStyleItemWhen); break;
|
||||||
case XSLT_FUNC_OTHERWISE:
|
case XSLT_FUNC_OTHERWISE:
|
||||||
size = sizeof(xsltStyleItemOtherwise); break;
|
size = sizeof(xsltStyleItemOtherwise); break;
|
||||||
default:
|
default:
|
||||||
xsltTransformError(NULL, style, NULL,
|
xsltTransformError(NULL, style, NULL,
|
||||||
"xsltNewStylePreComp : invalid type %d\n", type);
|
"xsltNewStylePreComp : invalid type %d\n", type);
|
||||||
style->errors++;
|
style->errors++;
|
||||||
@ -354,8 +354,8 @@ xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) {
|
|||||||
case XSLT_FUNC_DOCUMENT:
|
case XSLT_FUNC_DOCUMENT:
|
||||||
cur->func = (xsltTransformFunction) xsltDocumentElem;break;
|
cur->func = (xsltTransformFunction) xsltDocumentElem;break;
|
||||||
case XSLT_FUNC_WITHPARAM:
|
case XSLT_FUNC_WITHPARAM:
|
||||||
case XSLT_FUNC_PARAM:
|
case XSLT_FUNC_PARAM:
|
||||||
case XSLT_FUNC_VARIABLE:
|
case XSLT_FUNC_VARIABLE:
|
||||||
case XSLT_FUNC_WHEN:
|
case XSLT_FUNC_WHEN:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -484,18 +484,18 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) {
|
|||||||
xmlXPathFreeCompExpr(item->comp);
|
xmlXPathFreeCompExpr(item->comp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_OTHERWISE:
|
case XSLT_FUNC_OTHERWISE:
|
||||||
case XSLT_FUNC_FALLBACK:
|
case XSLT_FUNC_FALLBACK:
|
||||||
case XSLT_FUNC_MESSAGE:
|
case XSLT_FUNC_MESSAGE:
|
||||||
case XSLT_FUNC_INCLUDE:
|
case XSLT_FUNC_INCLUDE:
|
||||||
case XSLT_FUNC_ATTRSET:
|
case XSLT_FUNC_ATTRSET:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* TODO: Raise error. */
|
/* TODO: Raise error. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (comp->locale != (xsltLocale)0)
|
if (comp->locale != (xsltLocale)0)
|
||||||
xsltFreeLocale(comp->locale);
|
xsltFreeLocale(comp->locale);
|
||||||
if (comp->comp != NULL)
|
if (comp->comp != NULL)
|
||||||
@ -556,7 +556,7 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
#else
|
#else
|
||||||
comp = xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT);
|
comp = xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
comp->inst = inst;
|
comp->inst = inst;
|
||||||
@ -603,8 +603,8 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
#ifdef WITH_XSLT_DEBUG_EXTRA
|
#ifdef WITH_XSLT_DEBUG_EXTRA
|
||||||
xsltGenericDebug(xsltGenericDebugContext,
|
xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"Found xslt11:document construct\n");
|
"Found xslt11:document construct\n");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (xmlStrEqual(inst->ns->href,
|
if (xmlStrEqual(inst->ns->href,
|
||||||
(const xmlChar *)"http://exslt.org/common")) {
|
(const xmlChar *)"http://exslt.org/common")) {
|
||||||
/* EXSLT. */
|
/* EXSLT. */
|
||||||
@ -645,12 +645,12 @@ xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
* 3) XSLT_XT_NAMESPACE (http://www.jclark.com/xt)
|
* 3) XSLT_XT_NAMESPACE (http://www.jclark.com/xt)
|
||||||
* Example: <xt:document method="xml" href="myFile.xml">
|
* Example: <xt:document method="xml" href="myFile.xml">
|
||||||
* TODO: is @href is an AVT?
|
* TODO: is @href is an AVT?
|
||||||
*
|
*
|
||||||
* In all cases @href is in no namespace.
|
* In all cases @href is in no namespace.
|
||||||
*/
|
*/
|
||||||
filename = xsltEvalStaticAttrValueTemplate(style, inst,
|
filename = xsltEvalStaticAttrValueTemplate(style, inst,
|
||||||
(const xmlChar *)"href", NULL, &comp->has_filename);
|
(const xmlChar *)"href", NULL, &comp->has_filename);
|
||||||
}
|
}
|
||||||
if (!comp->has_filename) {
|
if (!comp->has_filename) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
#else
|
#else
|
||||||
comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT);
|
comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return;
|
return;
|
||||||
inst->psvi = comp;
|
inst->psvi = comp;
|
||||||
@ -795,7 +795,7 @@ xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
#else
|
#else
|
||||||
comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY);
|
comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return;
|
return;
|
||||||
inst->psvi = comp;
|
inst->psvi = comp;
|
||||||
@ -839,7 +839,7 @@ xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
|
comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
|
||||||
#else
|
#else
|
||||||
comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
|
comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
|
||||||
#endif
|
#endif
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return;
|
return;
|
||||||
inst->psvi = comp;
|
inst->psvi = comp;
|
||||||
@ -921,8 +921,8 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
*/
|
*/
|
||||||
comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
|
comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
|
||||||
(const xmlChar *)"namespace", NULL, &comp->has_ns);
|
(const xmlChar *)"namespace", NULL, &comp->has_ns);
|
||||||
|
|
||||||
if (comp->name != NULL) {
|
if (comp->name != NULL) {
|
||||||
if (xmlValidateQName(comp->name, 0)) {
|
if (xmlValidateQName(comp->name, 0)) {
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
"xsl:element: The value '%s' of the attribute 'name' is "
|
"xsl:element: The value '%s' of the attribute 'name' is "
|
||||||
@ -932,7 +932,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
const xmlChar *prefix = NULL, *name;
|
const xmlChar *prefix = NULL, *name;
|
||||||
|
|
||||||
name = xsltSplitQName(style->dict, comp->name, &prefix);
|
name = xsltSplitQName(style->dict, comp->name, &prefix);
|
||||||
if (comp->has_ns == 0) {
|
if (comp->has_ns == 0) {
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -941,7 +941,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
* expanded into an expanded-name using the namespace declarations
|
* expanded into an expanded-name using the namespace declarations
|
||||||
* in effect for the xsl:element element, including any default
|
* in effect for the xsl:element element, including any default
|
||||||
* namespace declaration.
|
* namespace declaration.
|
||||||
*/
|
*/
|
||||||
ns = xmlSearchNs(inst->doc, inst, prefix);
|
ns = xmlSearchNs(inst->doc, inst, prefix);
|
||||||
if (ns != NULL) {
|
if (ns != NULL) {
|
||||||
comp->ns = xmlDictLookup(style->dict, ns->href, -1);
|
comp->ns = xmlDictLookup(style->dict, ns->href, -1);
|
||||||
@ -958,17 +958,17 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
"not specified by the instruction itself.\n", comp->name);
|
"not specified by the instruction itself.\n", comp->name);
|
||||||
style->errors++;
|
style->errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((prefix != NULL) &&
|
if ((prefix != NULL) &&
|
||||||
(!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)))
|
(!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Mark is to be skipped.
|
* Mark is to be skipped.
|
||||||
*/
|
*/
|
||||||
comp->has_name = 0;
|
comp->has_name = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Attribute "use-attribute-sets",
|
* Attribute "use-attribute-sets",
|
||||||
*/
|
*/
|
||||||
@ -976,7 +976,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
(const xmlChar *)"use-attribute-sets",
|
(const xmlChar *)"use-attribute-sets",
|
||||||
NULL, &comp->has_use);
|
NULL, &comp->has_use);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,7 +1011,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
#else
|
#else
|
||||||
comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE);
|
comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return;
|
return;
|
||||||
inst->psvi = comp;
|
inst->psvi = comp;
|
||||||
@ -1031,7 +1031,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
"XSLT-attribute: The attribute 'name' is missing.\n");
|
"XSLT-attribute: The attribute 'name' is missing.\n");
|
||||||
style->errors++;
|
style->errors++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Attribute "namespace".
|
* Attribute "namespace".
|
||||||
*/
|
*/
|
||||||
@ -1066,7 +1066,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
* QName is expanded into an expanded-name using the
|
* QName is expanded into an expanded-name using the
|
||||||
* namespace declarations in effect for the xsl:element
|
* namespace declarations in effect for the xsl:element
|
||||||
* element, including any default namespace declaration.
|
* element, including any default namespace declaration.
|
||||||
*/
|
*/
|
||||||
ns = xmlSearchNs(inst->doc, inst, prefix);
|
ns = xmlSearchNs(inst->doc, inst, prefix);
|
||||||
if (ns != NULL) {
|
if (ns != NULL) {
|
||||||
comp->ns = xmlDictLookup(style->dict, ns->href, -1);
|
comp->ns = xmlDictLookup(style->dict, ns->href, -1);
|
||||||
@ -1086,7 +1086,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1459,14 +1459,14 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
if (style != NULL) style->warnings++;
|
if (style != NULL) style->warnings++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE);
|
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE);
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
xsltTransformError(NULL, style, cur,
|
xsltTransformError(NULL, style, cur,
|
||||||
"xsl:number : lang attribute not implemented\n");
|
"xsl:number : lang attribute not implemented\n");
|
||||||
XSLT_TODO; /* xsl:number lang attribute */
|
XSLT_TODO; /* xsl:number lang attribute */
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE);
|
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE);
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) {
|
if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) {
|
||||||
@ -1485,7 +1485,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
if (style != NULL) style->warnings++;
|
if (style != NULL) style->warnings++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator",
|
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator",
|
||||||
XSLT_NAMESPACE);
|
XSLT_NAMESPACE);
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
@ -1493,7 +1493,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
comp->numdata.groupingCharacter =
|
comp->numdata.groupingCharacter =
|
||||||
xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen));
|
xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE);
|
prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE);
|
||||||
if (prop != NULL) {
|
if (prop != NULL) {
|
||||||
sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup);
|
sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup);
|
||||||
@ -1508,7 +1508,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
BAD_CAST"single", 6);
|
BAD_CAST"single", 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1843,7 +1843,7 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
xsltGetQNameProperty(style, inst, BAD_CAST "name",
|
xsltGetQNameProperty(style, inst, BAD_CAST "name",
|
||||||
1, &(comp->has_name), &(comp->ns), &(comp->name));
|
1, &(comp->has_name), &(comp->ns), &(comp->name));
|
||||||
if (comp->ns)
|
if (comp->ns)
|
||||||
comp->has_ns = 1;
|
comp->has_ns = 1;
|
||||||
/*
|
/*
|
||||||
* Attribute "select".
|
* Attribute "select".
|
||||||
*/
|
*/
|
||||||
@ -1958,11 +1958,11 @@ xsltFreeStylePreComps(xsltStylesheetPtr style) {
|
|||||||
xsltElemPreCompPtr cur, next;
|
xsltElemPreCompPtr cur, next;
|
||||||
|
|
||||||
if (style == NULL)
|
if (style == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cur = style->preComps;
|
cur = style->preComps;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
next = cur->next;
|
next = cur->next;
|
||||||
if (cur->type == XSLT_FUNC_EXTENSION)
|
if (cur->type == XSLT_FUNC_EXTENSION)
|
||||||
cur->free(cur);
|
cur->free(cur);
|
||||||
else
|
else
|
||||||
@ -1984,7 +1984,7 @@ xsltFreeStylePreComps(xsltStylesheetPtr style) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
||||||
/*
|
/*
|
||||||
* The xsltXSLTElemMarker marker was set beforehand by
|
* The xsltXSLTElemMarker marker was set beforehand by
|
||||||
* the parsing mechanism for all elements in the XSLT namespace.
|
* the parsing mechanism for all elements in the XSLT namespace.
|
||||||
*/
|
*/
|
||||||
@ -2004,67 +2004,67 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
case XSLT_FUNC_APPLYTEMPLATES:
|
case XSLT_FUNC_APPLYTEMPLATES:
|
||||||
xsltApplyTemplatesComp(style, node);
|
xsltApplyTemplatesComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_WITHPARAM:
|
case XSLT_FUNC_WITHPARAM:
|
||||||
xsltWithParamComp(style, node);
|
xsltWithParamComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_VALUEOF:
|
case XSLT_FUNC_VALUEOF:
|
||||||
xsltValueOfComp(style, node);
|
xsltValueOfComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_COPY:
|
case XSLT_FUNC_COPY:
|
||||||
xsltCopyComp(style, node);
|
xsltCopyComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_COPYOF:
|
case XSLT_FUNC_COPYOF:
|
||||||
xsltCopyOfComp(style, node);
|
xsltCopyOfComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_IF:
|
case XSLT_FUNC_IF:
|
||||||
xsltIfComp(style, node);
|
xsltIfComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_CHOOSE:
|
case XSLT_FUNC_CHOOSE:
|
||||||
xsltChooseComp(style, node);
|
xsltChooseComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_WHEN:
|
case XSLT_FUNC_WHEN:
|
||||||
xsltWhenComp(style, node);
|
xsltWhenComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_OTHERWISE:
|
case XSLT_FUNC_OTHERWISE:
|
||||||
/* NOP yet */
|
/* NOP yet */
|
||||||
return;
|
return;
|
||||||
case XSLT_FUNC_FOREACH:
|
case XSLT_FUNC_FOREACH:
|
||||||
xsltForEachComp(style, node);
|
xsltForEachComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_APPLYIMPORTS:
|
case XSLT_FUNC_APPLYIMPORTS:
|
||||||
xsltApplyImportsComp(style, node);
|
xsltApplyImportsComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_ATTRIBUTE:
|
case XSLT_FUNC_ATTRIBUTE:
|
||||||
xsltAttributeComp(style, node);
|
xsltAttributeComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_ELEMENT:
|
case XSLT_FUNC_ELEMENT:
|
||||||
xsltElementComp(style, node);
|
xsltElementComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_SORT:
|
case XSLT_FUNC_SORT:
|
||||||
xsltSortComp(style, node);
|
xsltSortComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_COMMENT:
|
case XSLT_FUNC_COMMENT:
|
||||||
xsltCommentComp(style, node);
|
xsltCommentComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_NUMBER:
|
case XSLT_FUNC_NUMBER:
|
||||||
xsltNumberComp(style, node);
|
xsltNumberComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_PI:
|
case XSLT_FUNC_PI:
|
||||||
xsltProcessingInstructionComp(style, node);
|
xsltProcessingInstructionComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_CALLTEMPLATE:
|
case XSLT_FUNC_CALLTEMPLATE:
|
||||||
xsltCallTemplateComp(style, node);
|
xsltCallTemplateComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_PARAM:
|
case XSLT_FUNC_PARAM:
|
||||||
xsltParamComp(style, node);
|
xsltParamComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_VARIABLE:
|
case XSLT_FUNC_VARIABLE:
|
||||||
xsltVariableComp(style, node);
|
xsltVariableComp(style, node);
|
||||||
break;
|
break;
|
||||||
case XSLT_FUNC_FALLBACK:
|
case XSLT_FUNC_FALLBACK:
|
||||||
/* NOP yet */
|
/* NOP yet */
|
||||||
return;
|
return;
|
||||||
case XSLT_FUNC_DOCUMENT:
|
case XSLT_FUNC_DOCUMENT:
|
||||||
/* The extra one */
|
/* The extra one */
|
||||||
node->psvi = (void *) xsltDocumentComp(style, node,
|
node->psvi = (void *) xsltDocumentComp(style, node,
|
||||||
(xsltTransformFunction) xsltDocumentElem);
|
(xsltTransformFunction) xsltDocumentElem);
|
||||||
@ -2087,7 +2087,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Fallback to string comparison.
|
* Fallback to string comparison.
|
||||||
*/
|
*/
|
||||||
if (IS_XSLT_NAME(node, "apply-templates")) {
|
if (IS_XSLT_NAME(node, "apply-templates")) {
|
||||||
xsltApplyTemplatesComp(style, node);
|
xsltApplyTemplatesComp(style, node);
|
||||||
} else if (IS_XSLT_NAME(node, "with-param")) {
|
} else if (IS_XSLT_NAME(node, "with-param")) {
|
||||||
@ -2103,7 +2103,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
} else if (IS_XSLT_NAME(node, "choose")) {
|
} else if (IS_XSLT_NAME(node, "choose")) {
|
||||||
xsltChooseComp(style, node);
|
xsltChooseComp(style, node);
|
||||||
} else if (IS_XSLT_NAME(node, "when")) {
|
} else if (IS_XSLT_NAME(node, "when")) {
|
||||||
xsltWhenComp(style, node);
|
xsltWhenComp(style, node);
|
||||||
} else if (IS_XSLT_NAME(node, "otherwise")) {
|
} else if (IS_XSLT_NAME(node, "otherwise")) {
|
||||||
/* NOP yet */
|
/* NOP yet */
|
||||||
return;
|
return;
|
||||||
@ -2135,7 +2135,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
} else if (IS_XSLT_NAME(node, "document")) {
|
} else if (IS_XSLT_NAME(node, "document")) {
|
||||||
/* The extra one */
|
/* The extra one */
|
||||||
node->psvi = (void *) xsltDocumentComp(style, node,
|
node->psvi = (void *) xsltDocumentComp(style, node,
|
||||||
(xsltTransformFunction) xsltDocumentElem);
|
(xsltTransformFunction) xsltDocumentElem);
|
||||||
} else if (IS_XSLT_NAME(node, "output")) {
|
} else if (IS_XSLT_NAME(node, "output")) {
|
||||||
/* Top-level */
|
/* Top-level */
|
||||||
return;
|
return;
|
||||||
@ -2144,7 +2144,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
return;
|
return;
|
||||||
} else if (IS_XSLT_NAME(node, "strip-space")) {
|
} else if (IS_XSLT_NAME(node, "strip-space")) {
|
||||||
/* Top-level */
|
/* Top-level */
|
||||||
return;
|
return;
|
||||||
} else if (IS_XSLT_NAME(node, "key")) {
|
} else if (IS_XSLT_NAME(node, "key")) {
|
||||||
/* Top-level */
|
/* Top-level */
|
||||||
return;
|
return;
|
||||||
@ -2160,7 +2160,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
/* Top-level */
|
/* Top-level */
|
||||||
return;
|
return;
|
||||||
} else if (IS_XSLT_NAME(node, "include")) {
|
} else if (IS_XSLT_NAME(node, "include")) {
|
||||||
/* Top-level */
|
/* Top-level */
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* NOTE that xsl:text, xsl:template, xsl:stylesheet,
|
* NOTE that xsl:text, xsl:template, xsl:stylesheet,
|
||||||
@ -2172,7 +2172,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
|
|||||||
"the XSLT element '%s'.\n", node->name);
|
"the XSLT element '%s'.\n", node->name);
|
||||||
style->errors++;
|
style->errors++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Assign the current list of in-scope namespaces to the
|
* Assign the current list of in-scope namespaces to the
|
||||||
@ -2274,7 +2274,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
} else if (IS_XSLT_NAME(inst, "call-template")) {
|
} else if (IS_XSLT_NAME(inst, "call-template")) {
|
||||||
xsltCheckInstructionElement(style, inst);
|
xsltCheckInstructionElement(style, inst);
|
||||||
xsltCallTemplateComp(style, inst);
|
xsltCallTemplateComp(style, inst);
|
||||||
} else if (IS_XSLT_NAME(inst, "param")) {
|
} else if (IS_XSLT_NAME(inst, "param")) {
|
||||||
if (xsltCheckTopLevelElement(style, inst, 0) == 0)
|
if (xsltCheckTopLevelElement(style, inst, 0) == 0)
|
||||||
xsltCheckInstructionElement(style, inst);
|
xsltCheckInstructionElement(style, inst);
|
||||||
xsltParamComp(style, inst);
|
xsltParamComp(style, inst);
|
||||||
@ -2342,7 +2342,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
|
|||||||
"xsltStylePreCompute: unknown xsl:%s\n", inst->name);
|
"xsltStylePreCompute: unknown xsl:%s\n", inst->name);
|
||||||
if (style != NULL) style->warnings++;
|
if (style != NULL) style->warnings++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = (xsltStylePreCompPtr) inst->psvi;
|
cur = (xsltStylePreCompPtr) inst->psvi;
|
||||||
/*
|
/*
|
||||||
* A ns-list is build for every XSLT item in the
|
* A ns-list is build for every XSLT item in the
|
||||||
|
@ -24,15 +24,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
extern const xmlChar *xsltExtMarker;
|
extern const xmlChar *xsltExtMarker;
|
||||||
|
|
||||||
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
|
XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
|
||||||
xsltDocumentComp (xsltStylesheetPtr style,
|
xsltDocumentComp (xsltStylesheetPtr style,
|
||||||
xmlNodePtr inst,
|
xmlNodePtr inst,
|
||||||
xsltTransformFunction function);
|
xsltTransformFunction function);
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltStylePreCompute (xsltStylesheetPtr style,
|
xsltStylePreCompute (xsltStylesheetPtr style,
|
||||||
xmlNodePtr inst);
|
xmlNodePtr inst);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeStylePreComps (xsltStylesheetPtr style);
|
xsltFreeStylePreComps (xsltStylesheetPtr style);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -181,7 +181,7 @@ xsltGetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) {
|
xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) {
|
||||||
|
|
||||||
xsltDefaultSecurityPrefs = sec;
|
xsltDefaultSecurityPrefs = sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ xsltGetDefaultSecurityPrefs(void) {
|
|||||||
*
|
*
|
||||||
* Returns -1 in case of error, 0 otherwise
|
* Returns -1 in case of error, 0 otherwise
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xsltSetCtxtSecurityPrefs(xsltSecurityPrefsPtr sec,
|
xsltSetCtxtSecurityPrefs(xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt) {
|
xsltTransformContextPtr ctxt) {
|
||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
@ -265,7 +265,7 @@ xsltSecurityForbid(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED,
|
|||||||
*
|
*
|
||||||
* TODO: remove at some point !!!
|
* TODO: remove at some point !!!
|
||||||
* Local copy of xmlCheckFilename to avoid a hard dependency on
|
* Local copy of xmlCheckFilename to avoid a hard dependency on
|
||||||
* a new version of libxml2
|
* a new version of libxml2
|
||||||
*
|
*
|
||||||
* if stat is not available on the target machine,
|
* if stat is not available on the target machine,
|
||||||
* returns 1. if stat fails, returns 0 (if calling
|
* returns 1. if stat fails, returns 0 (if calling
|
||||||
@ -282,7 +282,7 @@ xsltCheckFilename (const char *path)
|
|||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
DWORD dwAttrs;
|
DWORD dwAttrs;
|
||||||
|
|
||||||
dwAttrs = GetFileAttributes(path);
|
dwAttrs = GetFileAttributes(path);
|
||||||
if (dwAttrs != INVALID_FILE_ATTRIBUTES) {
|
if (dwAttrs != INVALID_FILE_ATTRIBUTES) {
|
||||||
if (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) {
|
if (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -55,43 +55,43 @@ typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec,
|
|||||||
/*
|
/*
|
||||||
* Module interfaces
|
* Module interfaces
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
||||||
xsltNewSecurityPrefs (void);
|
xsltNewSecurityPrefs (void);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec);
|
xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||||
xsltSecurityOption option,
|
xsltSecurityOption option,
|
||||||
xsltSecurityCheck func);
|
xsltSecurityCheck func);
|
||||||
XSLTPUBFUN xsltSecurityCheck XSLTCALL
|
XSLTPUBFUN xsltSecurityCheck XSLTCALL
|
||||||
xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||||
xsltSecurityOption option);
|
xsltSecurityOption option);
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec);
|
xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec);
|
||||||
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL
|
||||||
xsltGetDefaultSecurityPrefs (void);
|
xsltGetDefaultSecurityPrefs (void);
|
||||||
|
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec,
|
xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt);
|
xsltTransformContextPtr ctxt);
|
||||||
|
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSecurityAllow (xsltSecurityPrefsPtr sec,
|
xsltSecurityAllow (xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt,
|
xsltTransformContextPtr ctxt,
|
||||||
const char *value);
|
const char *value);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSecurityForbid (xsltSecurityPrefsPtr sec,
|
xsltSecurityForbid (xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt,
|
xsltTransformContextPtr ctxt,
|
||||||
const char *value);
|
const char *value);
|
||||||
/*
|
/*
|
||||||
* internal interfaces
|
* internal interfaces
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltCheckWrite (xsltSecurityPrefsPtr sec,
|
xsltCheckWrite (xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt,
|
xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *URL);
|
const xmlChar *URL);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltCheckRead (xsltSecurityPrefsPtr sec,
|
xsltCheckRead (xsltSecurityPrefsPtr sec,
|
||||||
xsltTransformContextPtr ctxt,
|
xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *URL);
|
const xmlChar *URL);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
* Module interfaces *
|
* Module interfaces *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltEvalXPathPredicate:
|
* xsltEvalXPathPredicate:
|
||||||
* @ctxt: the XSLT transformation context
|
* @ctxt: the XSLT transformation context
|
||||||
@ -468,7 +468,7 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
* Evaluates Attribute Value Templates and copies the attribute over to
|
* Evaluates Attribute Value Templates and copies the attribute over to
|
||||||
* the result element.
|
* the result element.
|
||||||
* This does *not* process attribute sets (xsl:use-attribute-set).
|
* This does *not* process attribute sets (xsl:use-attribute-set).
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Returns the generated attribute node.
|
* Returns the generated attribute node.
|
||||||
*/
|
*/
|
||||||
@ -482,14 +482,14 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
|||||||
if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
|
if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
|
||||||
(target->type != XML_ELEMENT_NODE))
|
(target->type != XML_ELEMENT_NODE))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
if (attr->type != XML_ATTRIBUTE_NODE)
|
if (attr->type != XML_ATTRIBUTE_NODE)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip all XSLT attributes.
|
* Skip all XSLT attributes.
|
||||||
*/
|
*/
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
if (attr->psvi == xsltXSLTAttrMarker)
|
if (attr->psvi == xsltXSLTAttrMarker)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
#else
|
#else
|
||||||
@ -526,7 +526,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
|||||||
}
|
}
|
||||||
ret = ret->next;
|
ret = ret->next;
|
||||||
}
|
}
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
/* free the existing value */
|
/* free the existing value */
|
||||||
xmlFreeNodeList(ret->children);
|
xmlFreeNodeList(ret->children);
|
||||||
ret->children = ret->last = NULL;
|
ret->children = ret->last = NULL;
|
||||||
@ -545,7 +545,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
|||||||
xsltGetNamespace(ctxt, attr->parent, attr->ns, target),
|
xsltGetNamespace(ctxt, attr->parent, attr->ns, target),
|
||||||
attr->name, NULL);
|
attr->name, NULL);
|
||||||
else
|
else
|
||||||
ret = xmlNewNsProp(target, NULL, attr->name, NULL);
|
ret = xmlNewNsProp(target, NULL, attr->name, NULL);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Set the value.
|
* Set the value.
|
||||||
@ -597,11 +597,11 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
|||||||
} else {
|
} else {
|
||||||
if (attr->ns) {
|
if (attr->ns) {
|
||||||
xsltTransformError(ctxt, NULL, attr->parent,
|
xsltTransformError(ctxt, NULL, attr->parent,
|
||||||
"Internal error: Failed to create attribute '{%s}%s'.\n",
|
"Internal error: Failed to create attribute '{%s}%s'.\n",
|
||||||
attr->ns->href, attr->name);
|
attr->ns->href, attr->name);
|
||||||
} else {
|
} else {
|
||||||
xsltTransformError(ctxt, NULL, attr->parent,
|
xsltTransformError(ctxt, NULL, attr->parent,
|
||||||
"Internal error: Failed to create attribute '%s'.\n",
|
"Internal error: Failed to create attribute '%s'.\n",
|
||||||
attr->name);
|
attr->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,7 +629,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
|||||||
* attributes will be disattached.)
|
* attributes will be disattached.)
|
||||||
*/
|
*/
|
||||||
xmlAttrPtr
|
xmlAttrPtr
|
||||||
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr target, xmlAttrPtr attrs)
|
xmlNodePtr target, xmlAttrPtr attrs)
|
||||||
{
|
{
|
||||||
xmlAttrPtr attr, copy, last;
|
xmlAttrPtr attr, copy, last;
|
||||||
@ -643,7 +643,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
oldInsert = ctxt->insert;
|
oldInsert = ctxt->insert;
|
||||||
ctxt->insert = target;
|
ctxt->insert = target;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instantiate LRE-attributes.
|
* Instantiate LRE-attributes.
|
||||||
@ -836,7 +836,7 @@ xmlNodePtr *
|
|||||||
xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) {
|
xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) {
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,21 +20,21 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltEvalXPathPredicate (xsltTransformContextPtr ctxt,
|
xsltEvalXPathPredicate (xsltTransformContextPtr ctxt,
|
||||||
xmlXPathCompExprPtr comp,
|
xmlXPathCompExprPtr comp,
|
||||||
xmlNsPtr *nsList,
|
xmlNsPtr *nsList,
|
||||||
int nsNr);
|
int nsNr);
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltEvalTemplateString (xsltTransformContextPtr ctxt,
|
xsltEvalTemplateString (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr contextNode,
|
xmlNodePtr contextNode,
|
||||||
xmlNodePtr inst);
|
xmlNodePtr inst);
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt,
|
xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *ns);
|
const xmlChar *ns);
|
||||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||||
xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style,
|
xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
@ -42,30 +42,30 @@ XSLTPUBFUN const xmlChar * XSLTCALL
|
|||||||
int *found);
|
int *found);
|
||||||
|
|
||||||
/* TODO: this is obviously broken ... the namespaces should be passed too ! */
|
/* TODO: this is obviously broken ... the namespaces should be passed too ! */
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltEvalXPathString (xsltTransformContextPtr ctxt,
|
xsltEvalXPathString (xsltTransformContextPtr ctxt,
|
||||||
xmlXPathCompExprPtr comp);
|
xmlXPathCompExprPtr comp);
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltEvalXPathStringNs (xsltTransformContextPtr ctxt,
|
xsltEvalXPathStringNs (xsltTransformContextPtr ctxt,
|
||||||
xmlXPathCompExprPtr comp,
|
xmlXPathCompExprPtr comp,
|
||||||
int nsNr,
|
int nsNr,
|
||||||
xmlNsPtr *nsList);
|
xmlNsPtr *nsList);
|
||||||
|
|
||||||
XSLTPUBFUN xmlNodePtr * XSLTCALL
|
XSLTPUBFUN xmlNodePtr * XSLTCALL
|
||||||
xsltTemplateProcess (xsltTransformContextPtr ctxt,
|
xsltTemplateProcess (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
||||||
xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt,
|
xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr target,
|
xmlNodePtr target,
|
||||||
xmlAttrPtr cur);
|
xmlAttrPtr cur);
|
||||||
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
XSLTPUBFUN xmlAttrPtr XSLTCALL
|
||||||
xsltAttrTemplateProcess (xsltTransformContextPtr ctxt,
|
xsltAttrTemplateProcess (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr target,
|
xmlNodePtr target,
|
||||||
xmlAttrPtr attr);
|
xmlAttrPtr attr);
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt,
|
xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar* attr);
|
const xmlChar* attr);
|
||||||
XSLTPUBFUN xmlChar * XSLTCALL
|
XSLTPUBFUN xmlChar * XSLTCALL
|
||||||
xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
|
xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
|
||||||
const xmlChar* str,
|
const xmlChar* str,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
|
@ -294,7 +294,7 @@ static void
|
|||||||
profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent)
|
profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (templ->templMax == 0) {
|
if (templ->templMax == 0) {
|
||||||
templ->templMax = 4;
|
templ->templMax = 4;
|
||||||
templ->templCalledTab =
|
templ->templCalledTab =
|
||||||
|
@ -57,7 +57,7 @@ const xmlChar *xsltComputingGlobalVarMarker =
|
|||||||
* @ctxt: an XSLT transformation context
|
* @ctxt: an XSLT transformation context
|
||||||
*
|
*
|
||||||
* Creates a Result Value Tree
|
* Creates a Result Value Tree
|
||||||
* (the XSLT 1.0 term for this is "Result Tree Fragment")
|
* (the XSLT 1.0 term for this is "Result Tree Fragment")
|
||||||
*
|
*
|
||||||
* Returns the result value tree or NULL in case of API or internal errors.
|
* Returns the result value tree or NULL in case of API or internal errors.
|
||||||
*/
|
*/
|
||||||
@ -69,7 +69,7 @@ xsltCreateRVT(xsltTransformContextPtr ctxt)
|
|||||||
/*
|
/*
|
||||||
* Question: Why is this function public?
|
* Question: Why is this function public?
|
||||||
* Answer: It is called by the EXSLT module.
|
* Answer: It is called by the EXSLT module.
|
||||||
*/
|
*/
|
||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ xsltRegisterLocalRVT(xsltTransformContextPtr ctxt,
|
|||||||
{
|
{
|
||||||
if ((ctxt == NULL) || (RVT == NULL))
|
if ((ctxt == NULL) || (RVT == NULL))
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When evaluating "select" expressions of xsl:variable
|
* When evaluating "select" expressions of xsl:variable
|
||||||
* and xsl:param, we need to bind newly created tree fragments
|
* and xsl:param, we need to bind newly created tree fragments
|
||||||
@ -272,7 +272,7 @@ xsltExtensionInstructionResultRegister(xsltTransformContextPtr ctxt,
|
|||||||
(((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE))
|
(((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE))
|
||||||
{
|
{
|
||||||
cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
|
cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
|
||||||
doc = cur->doc;
|
doc = cur->doc;
|
||||||
} else {
|
} else {
|
||||||
xsltTransformError(ctxt, NULL, ctxt->inst,
|
xsltTransformError(ctxt, NULL, ctxt->inst,
|
||||||
"Internal error in "
|
"Internal error in "
|
||||||
@ -333,7 +333,7 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Clear the document tree.
|
* Clear the document tree.
|
||||||
* REVISIT TODO: Do we expect ID/IDREF tables to be existent?
|
* REVISIT TODO: Do we expect ID/IDREF tables to be existent?
|
||||||
*/
|
*/
|
||||||
if (RVT->children != NULL) {
|
if (RVT->children != NULL) {
|
||||||
xmlFreeNodeList(RVT->children);
|
xmlFreeNodeList(RVT->children);
|
||||||
@ -522,7 +522,7 @@ xsltCopyStackElem(xsltStackElemPtr elem) {
|
|||||||
cur->nameURI = elem->nameURI;
|
cur->nameURI = elem->nameURI;
|
||||||
cur->select = elem->select;
|
cur->select = elem->select;
|
||||||
cur->tree = elem->tree;
|
cur->tree = elem->tree;
|
||||||
cur->comp = elem->comp;
|
cur->comp = elem->comp;
|
||||||
return(cur);
|
return(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,13 +563,13 @@ xsltFreeStackElem(xsltStackElemPtr elem) {
|
|||||||
* </xsl:variable>
|
* </xsl:variable>
|
||||||
* <f:result select="$bar"/>
|
* <f:result select="$bar"/>
|
||||||
* </f:function>
|
* </f:function>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
xsltRegisterLocalRVT(elem->context, cur);
|
xsltRegisterLocalRVT(elem->context, cur);
|
||||||
} else {
|
} else {
|
||||||
xsltReleaseRVT((xsltTransformContextPtr) elem->context,
|
xsltReleaseRVT((xsltTransformContextPtr) elem->context,
|
||||||
cur);
|
cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -583,7 +583,7 @@ xsltFreeStackElem(xsltStackElemPtr elem) {
|
|||||||
memset(elem, 0, sizeof(xsltStackElem));
|
memset(elem, 0, sizeof(xsltStackElem));
|
||||||
elem->context = ctxt;
|
elem->context = ctxt;
|
||||||
elem->next = ctxt->cache->stackItems;
|
elem->next = ctxt->cache->stackItems;
|
||||||
ctxt->cache->stackItems = elem;
|
ctxt->cache->stackItems = elem;
|
||||||
ctxt->cache->nbStackItems++;
|
ctxt->cache->nbStackItems++;
|
||||||
#ifdef XSLT_DEBUG_PROFILE_CACHE
|
#ifdef XSLT_DEBUG_PROFILE_CACHE
|
||||||
ctxt->cache->dbgCachedVars++;
|
ctxt->cache->dbgCachedVars++;
|
||||||
@ -602,7 +602,7 @@ xsltFreeStackElem(xsltStackElemPtr elem) {
|
|||||||
void
|
void
|
||||||
xsltFreeStackElemList(xsltStackElemPtr elem) {
|
xsltFreeStackElemList(xsltStackElemPtr elem) {
|
||||||
xsltStackElemPtr next;
|
xsltStackElemPtr next;
|
||||||
|
|
||||||
while (elem != NULL) {
|
while (elem != NULL) {
|
||||||
next = elem->next;
|
next = elem->next;
|
||||||
xsltFreeStackElem(elem);
|
xsltFreeStackElem(elem);
|
||||||
@ -709,7 +709,7 @@ xsltCheckStackElem(xsltTransformContextPtr ctxt, const xmlChar *name,
|
|||||||
else if (cur->comp->type == XSLT_FUNC_PARAM)
|
else if (cur->comp->type == XSLT_FUNC_PARAM)
|
||||||
return(2);
|
return(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,10 +757,10 @@ xsltAddStackElem(xsltTransformContextPtr ctxt, xsltStackElemPtr elem)
|
|||||||
}
|
}
|
||||||
ctxt->varsTab[ctxt->varsNr++] = elem;
|
ctxt->varsTab[ctxt->varsNr++] = elem;
|
||||||
ctxt->vars = elem;
|
ctxt->vars = elem;
|
||||||
|
|
||||||
elem = elem->next;
|
elem = elem->next;
|
||||||
} while (elem != NULL);
|
} while (elem != NULL);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
(xsltStyleItemVariablePtr) castedComp;
|
(xsltStyleItemVariablePtr) castedComp;
|
||||||
#else
|
#else
|
||||||
xsltStylePreCompPtr comp = castedComp;
|
xsltStylePreCompPtr comp = castedComp;
|
||||||
#endif
|
#endif
|
||||||
xmlXPathObjectPtr result = NULL;
|
xmlXPathObjectPtr result = NULL;
|
||||||
xmlNodePtr oldInst;
|
xmlNodePtr oldInst;
|
||||||
|
|
||||||
@ -847,7 +847,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
oldXPContextSize = xpctxt->contextSize;
|
oldXPContextSize = xpctxt->contextSize;
|
||||||
oldXPNamespaces = xpctxt->namespaces;
|
oldXPNamespaces = xpctxt->namespaces;
|
||||||
oldXPNsNr = xpctxt->nsNr;
|
oldXPNsNr = xpctxt->nsNr;
|
||||||
|
|
||||||
xpctxt->node = ctxt->node;
|
xpctxt->node = ctxt->node;
|
||||||
/*
|
/*
|
||||||
* OPTIMIZE TODO: Lame try to set the context doc.
|
* OPTIMIZE TODO: Lame try to set the context doc.
|
||||||
@ -859,7 +859,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
/*
|
/*
|
||||||
* BUG TODO: The proximity position and the context size will
|
* BUG TODO: The proximity position and the context size will
|
||||||
* potentially be wrong.
|
* potentially be wrong.
|
||||||
* Example:
|
* Example:
|
||||||
* <xsl:template select="foo">
|
* <xsl:template select="foo">
|
||||||
* <xsl:variable name="pos" select="position()"/>
|
* <xsl:variable name="pos" select="position()"/>
|
||||||
* <xsl:for-each select="bar">
|
* <xsl:for-each select="bar">
|
||||||
@ -870,9 +870,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
* to the context of <xsl:for-each select="bar">, but
|
* to the context of <xsl:for-each select="bar">, but
|
||||||
* the variable needs to be evaluated in the context of
|
* the variable needs to be evaluated in the context of
|
||||||
* <xsl:template select="foo">.
|
* <xsl:template select="foo">.
|
||||||
*/
|
*/
|
||||||
if (comp != NULL) {
|
if (comp != NULL) {
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
if (comp->inScopeNs != NULL) {
|
if (comp->inScopeNs != NULL) {
|
||||||
xpctxt->namespaces = comp->inScopeNs->list;
|
xpctxt->namespaces = comp->inScopeNs->list;
|
||||||
@ -897,9 +897,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
* we'll eventually free still referenced fragments, before
|
* we'll eventually free still referenced fragments, before
|
||||||
* we leave the scope of the variable.
|
* we leave the scope of the variable.
|
||||||
*/
|
*/
|
||||||
ctxt->contextVariable = variable;
|
ctxt->contextVariable = variable;
|
||||||
variable->flags |= XSLT_VAR_IN_SELECT;
|
variable->flags |= XSLT_VAR_IN_SELECT;
|
||||||
|
|
||||||
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
||||||
|
|
||||||
variable->flags ^= XSLT_VAR_IN_SELECT;
|
variable->flags ^= XSLT_VAR_IN_SELECT;
|
||||||
@ -937,7 +937,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
} else {
|
} else {
|
||||||
if (variable->tree == NULL) {
|
if (variable->tree == NULL) {
|
||||||
result = xmlXPathNewCString("");
|
result = xmlXPathNewCString("");
|
||||||
} else {
|
} else {
|
||||||
if (variable->tree) {
|
if (variable->tree) {
|
||||||
xmlDocPtr container;
|
xmlDocPtr container;
|
||||||
xmlNodePtr oldInsert;
|
xmlNodePtr oldInsert;
|
||||||
@ -959,14 +959,14 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Attach the Result Tree Fragment to the variable;
|
* Attach the Result Tree Fragment to the variable;
|
||||||
* when the variable is freed, it will also free
|
* when the variable is freed, it will also free
|
||||||
* the Result Tree Fragment.
|
* the Result Tree Fragment.
|
||||||
*/
|
*/
|
||||||
variable->fragment = container;
|
variable->fragment = container;
|
||||||
|
|
||||||
oldOutput = ctxt->output;
|
oldOutput = ctxt->output;
|
||||||
oldInsert = ctxt->insert;
|
oldInsert = ctxt->insert;
|
||||||
|
|
||||||
ctxt->output = container;
|
ctxt->output = container;
|
||||||
ctxt->insert = (xmlNodePtr) container;
|
ctxt->insert = (xmlNodePtr) container;
|
||||||
ctxt->contextVariable = variable;
|
ctxt->contextVariable = variable;
|
||||||
@ -977,10 +977,10 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
xsltApplyOneTemplate(ctxt, ctxt->node, variable->tree,
|
xsltApplyOneTemplate(ctxt, ctxt->node, variable->tree,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
ctxt->contextVariable = oldVar;
|
ctxt->contextVariable = oldVar;
|
||||||
ctxt->insert = oldInsert;
|
ctxt->insert = oldInsert;
|
||||||
ctxt->output = oldOutput;
|
ctxt->output = oldOutput;
|
||||||
|
|
||||||
result = xmlXPathNewValueTree((xmlNodePtr) container);
|
result = xmlXPathNewValueTree((xmlNodePtr) container);
|
||||||
}
|
}
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
@ -990,7 +990,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
|
|||||||
* Freeing is not handled there anymore.
|
* Freeing is not handled there anymore.
|
||||||
* QUESTION TODO: What does the above comment mean?
|
* QUESTION TODO: What does the above comment mean?
|
||||||
*/
|
*/
|
||||||
result->boolval = 0;
|
result->boolval = 0;
|
||||||
}
|
}
|
||||||
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
||||||
#ifdef LIBXML_DEBUG_ENABLED
|
#ifdef LIBXML_DEBUG_ENABLED
|
||||||
@ -1063,7 +1063,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
* called; and in the case of global params, if values for such params
|
* called; and in the case of global params, if values for such params
|
||||||
* are provided by the user.
|
* are provided by the user.
|
||||||
*/
|
*/
|
||||||
if (elem->select != NULL) {
|
if (elem->select != NULL) {
|
||||||
xmlXPathCompExprPtr xpExpr = NULL;
|
xmlXPathCompExprPtr xpExpr = NULL;
|
||||||
xmlDocPtr oldXPDoc;
|
xmlDocPtr oldXPDoc;
|
||||||
xmlNodePtr oldXPContextNode;
|
xmlNodePtr oldXPContextNode;
|
||||||
@ -1078,8 +1078,8 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
}
|
}
|
||||||
if (xpExpr == NULL)
|
if (xpExpr == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
||||||
if (comp != NULL)
|
if (comp != NULL)
|
||||||
ctxt->inst = comp->inst;
|
ctxt->inst = comp->inst;
|
||||||
else
|
else
|
||||||
@ -1091,7 +1091,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
* to process the root node of the source document: the current
|
* to process the root node of the source document: the current
|
||||||
* node is the root node of the source document and the current
|
* node is the root node of the source document and the current
|
||||||
* node list is a list containing just the root node of the source
|
* node list is a list containing just the root node of the source
|
||||||
* document."
|
* document."
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Save context states.
|
* Save context states.
|
||||||
@ -1102,14 +1102,14 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
oldXPContextSize = xpctxt->contextSize;
|
oldXPContextSize = xpctxt->contextSize;
|
||||||
oldXPNamespaces = xpctxt->namespaces;
|
oldXPNamespaces = xpctxt->namespaces;
|
||||||
oldXPNsNr = xpctxt->nsNr;
|
oldXPNsNr = xpctxt->nsNr;
|
||||||
|
|
||||||
xpctxt->node = ctxt->initialContextNode;
|
xpctxt->node = ctxt->initialContextNode;
|
||||||
xpctxt->doc = ctxt->initialContextDoc;
|
xpctxt->doc = ctxt->initialContextDoc;
|
||||||
xpctxt->contextSize = 1;
|
xpctxt->contextSize = 1;
|
||||||
xpctxt->proximityPosition = 1;
|
xpctxt->proximityPosition = 1;
|
||||||
|
|
||||||
if (comp != NULL) {
|
if (comp != NULL) {
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
if (comp->inScopeNs != NULL) {
|
if (comp->inScopeNs != NULL) {
|
||||||
xpctxt->namespaces = comp->inScopeNs->list;
|
xpctxt->namespaces = comp->inScopeNs->list;
|
||||||
@ -1126,7 +1126,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
xpctxt->namespaces = NULL;
|
xpctxt->namespaces = NULL;
|
||||||
xpctxt->nsNr = 0;
|
xpctxt->nsNr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1165,7 +1165,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
} else {
|
} else {
|
||||||
xmlDocPtr container;
|
xmlDocPtr container;
|
||||||
xmlNodePtr oldInsert;
|
xmlNodePtr oldInsert;
|
||||||
xmlDocPtr oldOutput, oldXPDoc;
|
xmlDocPtr oldOutput, oldXPDoc;
|
||||||
/*
|
/*
|
||||||
* Generate a result tree fragment.
|
* Generate a result tree fragment.
|
||||||
*/
|
*/
|
||||||
@ -1176,14 +1176,14 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
* Let the lifetime of the tree fragment be handled by
|
* Let the lifetime of the tree fragment be handled by
|
||||||
* the Libxslt's garbage collector.
|
* the Libxslt's garbage collector.
|
||||||
*/
|
*/
|
||||||
xsltRegisterPersistRVT(ctxt, container);
|
xsltRegisterPersistRVT(ctxt, container);
|
||||||
|
|
||||||
oldOutput = ctxt->output;
|
oldOutput = ctxt->output;
|
||||||
oldInsert = ctxt->insert;
|
oldInsert = ctxt->insert;
|
||||||
|
|
||||||
oldXPDoc = ctxt->xpathCtxt->doc;
|
oldXPDoc = ctxt->xpathCtxt->doc;
|
||||||
|
|
||||||
ctxt->output = container;
|
ctxt->output = container;
|
||||||
ctxt->insert = (xmlNodePtr) container;
|
ctxt->insert = (xmlNodePtr) container;
|
||||||
|
|
||||||
ctxt->xpathCtxt->doc = ctxt->initialContextDoc;
|
ctxt->xpathCtxt->doc = ctxt->initialContextDoc;
|
||||||
@ -1196,7 +1196,7 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
|
|||||||
|
|
||||||
ctxt->insert = oldInsert;
|
ctxt->insert = oldInsert;
|
||||||
ctxt->output = oldOutput;
|
ctxt->output = oldOutput;
|
||||||
|
|
||||||
result = xmlXPathNewValueTree((xmlNodePtr) container);
|
result = xmlXPathNewValueTree((xmlNodePtr) container);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
result = xmlXPathNewCString("");
|
result = xmlXPathNewCString("");
|
||||||
@ -1236,11 +1236,11 @@ error:
|
|||||||
int
|
int
|
||||||
xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
|
xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
|
||||||
xsltStackElemPtr elem;
|
xsltStackElemPtr elem;
|
||||||
xsltStylesheetPtr style;
|
xsltStylesheetPtr style;
|
||||||
|
|
||||||
if ((ctxt == NULL) || (ctxt->document == NULL))
|
if ((ctxt == NULL) || (ctxt->document == NULL))
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
||||||
XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"Registering global variables\n"));
|
"Registering global variables\n"));
|
||||||
@ -1251,7 +1251,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
|
|||||||
style = ctxt->style;
|
style = ctxt->style;
|
||||||
while (style != NULL) {
|
while (style != NULL) {
|
||||||
elem = style->variables;
|
elem = style->variables;
|
||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
||||||
if ((style->doc != NULL) && (style->doc->URL != NULL)) {
|
if ((style->doc != NULL) && (style->doc->URL != NULL)) {
|
||||||
XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
||||||
@ -1266,7 +1266,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
|
|||||||
/*
|
/*
|
||||||
* Global variables are stored in the variables pool.
|
* Global variables are stored in the variables pool.
|
||||||
*/
|
*/
|
||||||
def = (xsltStackElemPtr)
|
def = (xsltStackElemPtr)
|
||||||
xmlHashLookup2(ctxt->globalVars,
|
xmlHashLookup2(ctxt->globalVars,
|
||||||
elem->name, elem->nameURI);
|
elem->name, elem->nameURI);
|
||||||
if (def == NULL) {
|
if (def == NULL) {
|
||||||
@ -1297,7 +1297,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This part does the actual evaluation
|
* This part does the actual evaluation
|
||||||
*/
|
*/
|
||||||
xmlHashScan(ctxt->globalVars,
|
xmlHashScan(ctxt->globalVars,
|
||||||
(xmlHashScanner) xsltEvalGlobalVariable, ctxt);
|
(xmlHashScanner) xsltEvalGlobalVariable, ctxt);
|
||||||
|
|
||||||
@ -1423,7 +1423,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
const xmlChar *href;
|
const xmlChar *href;
|
||||||
xmlXPathCompExprPtr xpExpr;
|
xmlXPathCompExprPtr xpExpr;
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result;
|
||||||
|
|
||||||
xsltStackElemPtr elem;
|
xsltStackElemPtr elem;
|
||||||
int res;
|
int res;
|
||||||
void *res_ptr;
|
void *res_ptr;
|
||||||
@ -1505,7 +1505,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
|
int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
|
||||||
xmlNsPtr *oldXPNamespaces;
|
xmlNsPtr *oldXPNamespaces;
|
||||||
xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
|
xmlXPathContextPtr xpctxt = ctxt->xpathCtxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save context states.
|
* Save context states.
|
||||||
*/
|
*/
|
||||||
@ -1525,19 +1525,19 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
* node list is a list containing just the root node of the source
|
* node list is a list containing just the root node of the source
|
||||||
* document."
|
* document."
|
||||||
*/
|
*/
|
||||||
xpctxt->doc = ctxt->initialContextDoc;
|
xpctxt->doc = ctxt->initialContextDoc;
|
||||||
xpctxt->node = ctxt->initialContextNode;
|
xpctxt->node = ctxt->initialContextNode;
|
||||||
xpctxt->contextSize = 1;
|
xpctxt->contextSize = 1;
|
||||||
xpctxt->proximityPosition = 1;
|
xpctxt->proximityPosition = 1;
|
||||||
/*
|
/*
|
||||||
* There is really no in scope namespace for parameters on the
|
* There is really no in scope namespace for parameters on the
|
||||||
* command line.
|
* command line.
|
||||||
*/
|
*/
|
||||||
xpctxt->namespaces = NULL;
|
xpctxt->namespaces = NULL;
|
||||||
xpctxt->nsNr = 0;
|
xpctxt->nsNr = 0;
|
||||||
|
|
||||||
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
result = xmlXPathCompiledEval(xpExpr, xpctxt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Restore Context states.
|
* Restore Context states.
|
||||||
*/
|
*/
|
||||||
@ -1547,7 +1547,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
xpctxt->proximityPosition = oldXPProximityPosition;
|
xpctxt->proximityPosition = oldXPProximityPosition;
|
||||||
xpctxt->namespaces = oldXPNamespaces;
|
xpctxt->namespaces = oldXPNamespaces;
|
||||||
xpctxt->nsNr = oldXPNsNr;
|
xpctxt->nsNr = oldXPNsNr;
|
||||||
|
|
||||||
xmlXPathFreeCompExpr(xpExpr);
|
xmlXPathFreeCompExpr(xpExpr);
|
||||||
}
|
}
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
@ -1558,9 +1558,9 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If @eval is 0 then @value is to be taken literally and result is NULL
|
* If @eval is 0 then @value is to be taken literally and result is NULL
|
||||||
*
|
*
|
||||||
* If @eval is not 0, then @value is an XPath expression and has been
|
* If @eval is not 0, then @value is an XPath expression and has been
|
||||||
* successfully evaluated and result contains the resulting value and
|
* successfully evaluated and result contains the resulting value and
|
||||||
* is not NULL.
|
* is not NULL.
|
||||||
@ -1588,7 +1588,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
elem->computed = 1;
|
elem->computed = 1;
|
||||||
if (eval == 0) {
|
if (eval == 0) {
|
||||||
elem->value = xmlXPathNewString(value);
|
elem->value = xmlXPathNewString(value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
elem->value = result;
|
elem->value = result;
|
||||||
}
|
}
|
||||||
@ -1621,7 +1621,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt,
|
|||||||
*
|
*
|
||||||
* Returns 0 in case of success, -1 in case of error
|
* Returns 0 in case of success, -1 in case of error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
||||||
int indx = 0;
|
int indx = 0;
|
||||||
@ -1633,7 +1633,7 @@ xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
|||||||
while (params[indx] != NULL) {
|
while (params[indx] != NULL) {
|
||||||
name = (const xmlChar *) params[indx++];
|
name = (const xmlChar *) params[indx++];
|
||||||
value = (const xmlChar *) params[indx++];
|
value = (const xmlChar *) params[indx++];
|
||||||
if (xsltEvalOneUserParam(ctxt, name, value) != 0)
|
if (xsltEvalOneUserParam(ctxt, name, value) != 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1651,7 +1651,7 @@ xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
|||||||
*
|
*
|
||||||
* Returns 0 in case of success, -1 in case of error.
|
* Returns 0 in case of success, -1 in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
||||||
int indx = 0;
|
int indx = 0;
|
||||||
@ -1663,7 +1663,7 @@ xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
|||||||
while (params[indx] != NULL) {
|
while (params[indx] != NULL) {
|
||||||
name = (const xmlChar *) params[indx++];
|
name = (const xmlChar *) params[indx++];
|
||||||
value = (const xmlChar *) params[indx++];
|
value = (const xmlChar *) params[indx++];
|
||||||
if (xsltQuoteOneUserParam(ctxt, name, value) != 0)
|
if (xsltQuoteOneUserParam(ctxt, name, value) != 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1689,7 +1689,7 @@ xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
xsltEvalOneUserParam(xsltTransformContextPtr ctxt,
|
xsltEvalOneUserParam(xsltTransformContextPtr ctxt,
|
||||||
const xmlChar * name,
|
const xmlChar * name,
|
||||||
const xmlChar * value) {
|
const xmlChar * value) {
|
||||||
return xsltProcessUserParamInternal(ctxt, name, value,
|
return xsltProcessUserParamInternal(ctxt, name, value,
|
||||||
1 /* xpath eval ? */);
|
1 /* xpath eval ? */);
|
||||||
@ -1736,7 +1736,7 @@ xsltBuildVariable(xsltTransformContextPtr ctxt,
|
|||||||
(xsltStyleBasicItemVariablePtr) castedComp;
|
(xsltStyleBasicItemVariablePtr) castedComp;
|
||||||
#else
|
#else
|
||||||
xsltStylePreCompPtr comp = castedComp;
|
xsltStylePreCompPtr comp = castedComp;
|
||||||
#endif
|
#endif
|
||||||
xsltStackElemPtr elem;
|
xsltStackElemPtr elem;
|
||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
||||||
@ -1786,8 +1786,8 @@ xsltRegisterVariable(xsltTransformContextPtr ctxt,
|
|||||||
xsltStylePreCompPtr comp = castedComp;
|
xsltStylePreCompPtr comp = castedComp;
|
||||||
int present;
|
int present;
|
||||||
#endif
|
#endif
|
||||||
xsltStackElemPtr variable;
|
xsltStackElemPtr variable;
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
/*
|
/*
|
||||||
* REFACTORED NOTE: Redefinitions of vars/params are checked
|
* REFACTORED NOTE: Redefinitions of vars/params are checked
|
||||||
@ -1796,7 +1796,7 @@ xsltRegisterVariable(xsltTransformContextPtr ctxt,
|
|||||||
*/
|
*/
|
||||||
#else
|
#else
|
||||||
present = xsltCheckStackElem(ctxt, comp->name, comp->ns);
|
present = xsltCheckStackElem(ctxt, comp->name, comp->ns);
|
||||||
if (isParam == 0) {
|
if (isParam == 0) {
|
||||||
if ((present != 0) && (present != 3)) {
|
if ((present != 0) && (present != 3)) {
|
||||||
/* TODO: report QName. */
|
/* TODO: report QName. */
|
||||||
xsltTransformError(ctxt, NULL, comp->inst,
|
xsltTransformError(ctxt, NULL, comp->inst,
|
||||||
@ -1912,13 +1912,13 @@ xsltVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltParseStylesheetCallerParam:
|
* xsltParseStylesheetCallerParam:
|
||||||
* @ctxt: the XSLT transformation context
|
* @ctxt: the XSLT transformation context
|
||||||
* @inst: the xsl:with-param instruction element
|
* @inst: the xsl:with-param instruction element
|
||||||
*
|
*
|
||||||
* Processes an xsl:with-param instruction at transformation time.
|
* Processes an xsl:with-param instruction at transformation time.
|
||||||
* The value is compute, but not recorded.
|
* The value is compute, but not recorded.
|
||||||
* NOTE that this is also called with an *xsl:param* element
|
* NOTE that this is also called with an *xsl:param* element
|
||||||
* from exsltFuncFunctionFunction().
|
* from exsltFuncFunctionFunction().
|
||||||
*
|
*
|
||||||
* Returns the new xsltStackElemPtr or NULL
|
* Returns the new xsltStackElemPtr or NULL
|
||||||
*/
|
*/
|
||||||
@ -1934,7 +1934,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst)
|
|||||||
xmlNodePtr tree = NULL; /* The first child node of the instruction or
|
xmlNodePtr tree = NULL; /* The first child node of the instruction or
|
||||||
the instruction itself. */
|
the instruction itself. */
|
||||||
xsltStackElemPtr param = NULL;
|
xsltStackElemPtr param = NULL;
|
||||||
|
|
||||||
if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
|
if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -1943,7 +1943,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst)
|
|||||||
#else
|
#else
|
||||||
comp = (xsltStylePreCompPtr) inst->psvi;
|
comp = (xsltStylePreCompPtr) inst->psvi;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (comp == NULL) {
|
if (comp == NULL) {
|
||||||
xsltTransformError(ctxt, NULL, inst,
|
xsltTransformError(ctxt, NULL, inst,
|
||||||
"Internal error in xsltParseStylesheetCallerParam(): "
|
"Internal error in xsltParseStylesheetCallerParam(): "
|
||||||
@ -1996,7 +1996,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
|
|||||||
|
|
||||||
if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
|
if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
/*
|
/*
|
||||||
* Note that xsltStylePreCompute() will be called from
|
* Note that xsltStylePreCompute() will be called from
|
||||||
@ -2023,7 +2023,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
|
|||||||
* Parse the content (a sequence constructor) of xsl:variable.
|
* Parse the content (a sequence constructor) of xsl:variable.
|
||||||
*/
|
*/
|
||||||
if (cur->children != NULL) {
|
if (cur->children != NULL) {
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
|
xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
|
||||||
#else
|
#else
|
||||||
xsltParseTemplateContent(style, cur);
|
xsltParseTemplateContent(style, cur);
|
||||||
@ -2058,7 +2058,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
|
|
||||||
if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
|
if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
/*
|
/*
|
||||||
* Note that xsltStylePreCompute() will be called from
|
* Note that xsltStylePreCompute() will be called from
|
||||||
@ -2068,7 +2068,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
#else
|
#else
|
||||||
xsltStylePreCompute(style, cur);
|
xsltStylePreCompute(style, cur);
|
||||||
comp = (xsltStylePreCompPtr) cur->psvi;
|
comp = (xsltStylePreCompPtr) cur->psvi;
|
||||||
#endif
|
#endif
|
||||||
if (comp == NULL) {
|
if (comp == NULL) {
|
||||||
xsltTransformError(NULL, style, cur,
|
xsltTransformError(NULL, style, cur,
|
||||||
"xsl:param : compilation failed\n");
|
"xsl:param : compilation failed\n");
|
||||||
@ -2085,7 +2085,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
|
|||||||
* Parse the content (a sequence constructor) of xsl:param.
|
* Parse the content (a sequence constructor) of xsl:param.
|
||||||
*/
|
*/
|
||||||
if (cur->children != NULL) {
|
if (cur->children != NULL) {
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
|
xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children);
|
||||||
#else
|
#else
|
||||||
xsltParseTemplateContent(style, cur);
|
xsltParseTemplateContent(style, cur);
|
||||||
@ -2217,7 +2217,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name,
|
|||||||
XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"Lookup variable '%s'\n", name));
|
"Lookup variable '%s'\n", name));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tctxt = (xsltTransformContextPtr) ctxt;
|
tctxt = (xsltTransformContextPtr) ctxt;
|
||||||
/*
|
/*
|
||||||
* Local variables/params ---------------------------------------------
|
* Local variables/params ---------------------------------------------
|
||||||
@ -2241,7 +2241,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name,
|
|||||||
goto local_variable_found;
|
goto local_variable_found;
|
||||||
}
|
}
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Redo the lookup with interned strings to avoid string comparison.
|
* Redo the lookup with interned strings to avoid string comparison.
|
||||||
*
|
*
|
||||||
@ -2254,7 +2254,7 @@ xsltXPathVariableLookup(void *ctxt, const xmlChar *name,
|
|||||||
name = xmlDictLookup(tctxt->dict, name, -1);
|
name = xmlDictLookup(tctxt->dict, name, -1);
|
||||||
if (ns_uri)
|
if (ns_uri)
|
||||||
ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1);
|
ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1);
|
||||||
if ((tmpName != name) || (tmpNsName != ns_uri)) {
|
if ((tmpName != name) || (tmpNsName != ns_uri)) {
|
||||||
for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
|
for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
|
||||||
cur = tctxt->varsTab[i-1];
|
cur = tctxt->varsTab[i-1];
|
||||||
if ((cur->name == name) && (cur->nameURI == ns_uri)) {
|
if ((cur->name == name) && (cur->nameURI == ns_uri)) {
|
||||||
@ -2272,7 +2272,7 @@ local_variable_found:
|
|||||||
|
|
||||||
if (variable) {
|
if (variable) {
|
||||||
if (variable->computed == 0) {
|
if (variable->computed == 0) {
|
||||||
|
|
||||||
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
#ifdef WITH_XSLT_DEBUG_VARIABLE
|
||||||
XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
|
||||||
"uncomputed variable '%s'\n", name));
|
"uncomputed variable '%s'\n", name));
|
||||||
@ -2281,14 +2281,14 @@ local_variable_found:
|
|||||||
variable->computed = 1;
|
variable->computed = 1;
|
||||||
}
|
}
|
||||||
if (variable->value != NULL) {
|
if (variable->value != NULL) {
|
||||||
valueObj = xmlXPathObjectCopy(variable->value);
|
valueObj = xmlXPathObjectCopy(variable->value);
|
||||||
}
|
}
|
||||||
return(valueObj);
|
return(valueObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Global variables/params --------------------------------------------
|
* Global variables/params --------------------------------------------
|
||||||
*/
|
*/
|
||||||
if (tctxt->globalVars) {
|
if (tctxt->globalVars) {
|
||||||
valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri);
|
valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri);
|
||||||
}
|
}
|
||||||
|
@ -38,48 +38,48 @@ extern "C" {
|
|||||||
* Interfaces for the variable module.
|
* Interfaces for the variable module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltEvalGlobalVariables (xsltTransformContextPtr ctxt);
|
xsltEvalGlobalVariables (xsltTransformContextPtr ctxt);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltEvalUserParams (xsltTransformContextPtr ctxt,
|
xsltEvalUserParams (xsltTransformContextPtr ctxt,
|
||||||
const char **params);
|
const char **params);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltQuoteUserParams (xsltTransformContextPtr ctxt,
|
xsltQuoteUserParams (xsltTransformContextPtr ctxt,
|
||||||
const char **params);
|
const char **params);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltEvalOneUserParam (xsltTransformContextPtr ctxt,
|
xsltEvalOneUserParam (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar * name,
|
const xmlChar * name,
|
||||||
const xmlChar * value);
|
const xmlChar * value);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltQuoteOneUserParam (xsltTransformContextPtr ctxt,
|
xsltQuoteOneUserParam (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar * name,
|
const xmlChar * name,
|
||||||
const xmlChar * value);
|
const xmlChar * value);
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseGlobalVariable (xsltStylesheetPtr style,
|
xsltParseGlobalVariable (xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseGlobalParam (xsltStylesheetPtr style,
|
xsltParseGlobalParam (xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseStylesheetVariable (xsltTransformContextPtr ctxt,
|
xsltParseStylesheetVariable (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseStylesheetParam (xsltTransformContextPtr ctxt,
|
xsltParseStylesheetParam (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN xsltStackElemPtr XSLTCALL
|
XSLTPUBFUN xsltStackElemPtr XSLTCALL
|
||||||
xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt,
|
xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltAddStackElemList (xsltTransformContextPtr ctxt,
|
xsltAddStackElemList (xsltTransformContextPtr ctxt,
|
||||||
xsltStackElemPtr elems);
|
xsltStackElemPtr elems);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeGlobalVariables (xsltTransformContextPtr ctxt);
|
xsltFreeGlobalVariables (xsltTransformContextPtr ctxt);
|
||||||
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
||||||
xsltVariableLookup (xsltTransformContextPtr ctxt,
|
xsltVariableLookup (xsltTransformContextPtr ctxt,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *ns_uri);
|
const xmlChar *ns_uri);
|
||||||
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
XSLTPUBFUN xmlXPathObjectPtr XSLTCALL
|
||||||
xsltXPathVariableLookup (void *ctxt,
|
xsltXPathVariableLookup (void *ctxt,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *ns_uri);
|
const xmlChar *ns_uri);
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#if defined _MSC_VER || defined __MINGW32__
|
#if defined _MSC_VER || defined __MINGW32__
|
||||||
/* MS C-runtime has functions which can be used in order to determine if
|
/* MS C-runtime has functions which can be used in order to determine if
|
||||||
a given floating-point variable contains NaN, (+-)INF. These are
|
a given floating-point variable contains NaN, (+-)INF. These are
|
||||||
preferred, because floating-point technology is considered propriatary
|
preferred, because floating-point technology is considered propriatary
|
||||||
by MS and we can assume that their functions know more about their
|
by MS and we can assume that their functions know more about their
|
||||||
oddities than we do. */
|
oddities than we do. */
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
/* Bjorn Reese figured a quite nice construct for isinf() using the
|
/* Bjorn Reese figured a quite nice construct for isinf() using the
|
||||||
_fpclass() function. */
|
_fpclass() function. */
|
||||||
#ifndef isinf
|
#ifndef isinf
|
||||||
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
|
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
|
||||||
|
536
libxslt/xslt.c
536
libxslt/xslt.c
File diff suppressed because it is too large
Load Diff
@ -99,7 +99,7 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
/*
|
/*
|
||||||
* Global cleanup function.
|
* Global cleanup function.
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltCleanupGlobals (void);
|
xsltCleanupGlobals (void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Summary: internal data structures, constants and functions
|
* Summary: internal data structures, constants and functions
|
||||||
* Description: Internal data structures, constants and functions used
|
* Description: Internal data structures, constants and functions used
|
||||||
* by the XSLT engine.
|
* by the XSLT engine.
|
||||||
* They are not part of the API or ABI, i.e. they can change
|
* They are not part of the API or ABI, i.e. they can change
|
||||||
* without prior notice, use carefully.
|
* without prior notice, use carefully.
|
||||||
*
|
*
|
||||||
@ -101,7 +101,7 @@ extern const xmlChar *xsltXSLTAttrMarker;
|
|||||||
* XSLT_REFACTORED_XSLT_NSCOMP
|
* XSLT_REFACTORED_XSLT_NSCOMP
|
||||||
*
|
*
|
||||||
* Internal define to enable the pointer-comparison of
|
* Internal define to enable the pointer-comparison of
|
||||||
* namespaces of XSLT elements.
|
* namespaces of XSLT elements.
|
||||||
*/
|
*/
|
||||||
/* #define XSLT_REFACTORED_XSLT_NSCOMP */
|
/* #define XSLT_REFACTORED_XSLT_NSCOMP */
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ struct _xsltTemplate {
|
|||||||
int nbCalls; /* the number of time the template was called */
|
int nbCalls; /* the number of time the template was called */
|
||||||
unsigned long time; /* the time spent in this template */
|
unsigned long time; /* the time spent in this template */
|
||||||
void *params; /* xsl:param instructions */
|
void *params; /* xsl:param instructions */
|
||||||
|
|
||||||
int templNr; /* Nb of templates in the stack */
|
int templNr; /* Nb of templates in the stack */
|
||||||
int templMax; /* Size of the templtes stack */
|
int templMax; /* Size of the templtes stack */
|
||||||
xsltTemplatePtr *templCalledTab; /* templates called */
|
xsltTemplatePtr *templCalledTab; /* templates called */
|
||||||
@ -479,7 +479,7 @@ struct _xsltElemPreComp {
|
|||||||
xsltElemPreCompPtr next; /* next item in the global chained
|
xsltElemPreCompPtr next; /* next item in the global chained
|
||||||
list hold by xsltStylesheet. */
|
list hold by xsltStylesheet. */
|
||||||
xsltStyleType type; /* type of the element */
|
xsltStyleType type; /* type of the element */
|
||||||
xsltTransformFunction func; /* handling function */
|
xsltTransformFunction func; /* handling function */
|
||||||
xmlNodePtr inst; /* the node in the stylesheet's tree
|
xmlNodePtr inst; /* the node in the stylesheet's tree
|
||||||
corresponding to this item */
|
corresponding to this item */
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltPointerListClear (xsltPointerListPtr list);
|
xsltPointerListClear (xsltPointerListPtr list);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltPointerListAddSize (xsltPointerListPtr list,
|
xsltPointerListAddSize (xsltPointerListPtr list,
|
||||||
void *item,
|
void *item,
|
||||||
int initialSize);
|
int initialSize);
|
||||||
|
|
||||||
@ -526,12 +526,12 @@ typedef xsltNsListContainer *xsltNsListContainerPtr;
|
|||||||
struct _xsltNsListContainer {
|
struct _xsltNsListContainer {
|
||||||
xmlNsPtr *list;
|
xmlNsPtr *list;
|
||||||
int totalNumber;
|
int totalNumber;
|
||||||
int xpathNumber;
|
int xpathNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XSLT_ITEM_COMPATIBILITY_FIELDS:
|
* XSLT_ITEM_COMPATIBILITY_FIELDS:
|
||||||
*
|
*
|
||||||
* Fields for API compatibility to the structure
|
* Fields for API compatibility to the structure
|
||||||
* _xsltElemPreComp which is used for extension functions.
|
* _xsltElemPreComp which is used for extension functions.
|
||||||
* Note that @next is used for storage; it does not reflect a next
|
* Note that @next is used for storage; it does not reflect a next
|
||||||
@ -554,7 +554,7 @@ struct _xsltNsListContainer {
|
|||||||
/*
|
/*
|
||||||
xsltStylePreCompPtr parent;\
|
xsltStylePreCompPtr parent;\
|
||||||
xsltStylePreCompPtr children;\
|
xsltStylePreCompPtr children;\
|
||||||
xsltStylePreCompPtr nextItem;
|
xsltStylePreCompPtr nextItem;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -575,7 +575,7 @@ struct _xsltNsListContainer {
|
|||||||
XSLT_ITEM_NSINSCOPE_FIELDS
|
XSLT_ITEM_NSINSCOPE_FIELDS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _xsltStylePreComp:
|
* _xsltStylePreComp:
|
||||||
*
|
*
|
||||||
* The abstract basic structure for items of the XSLT processor.
|
* The abstract basic structure for items of the XSLT processor.
|
||||||
* This includes:
|
* This includes:
|
||||||
@ -590,7 +590,7 @@ struct _xsltNsListContainer {
|
|||||||
struct _xsltStylePreComp {
|
struct _xsltStylePreComp {
|
||||||
xsltElemPreCompPtr next; /* next item in the global chained
|
xsltElemPreCompPtr next; /* next item in the global chained
|
||||||
list hold by xsltStylesheet */
|
list hold by xsltStylesheet */
|
||||||
xsltStyleType type; /* type of the item */
|
xsltStyleType type; /* type of the item */
|
||||||
xsltTransformFunction func; /* handling function */
|
xsltTransformFunction func; /* handling function */
|
||||||
xmlNodePtr inst; /* the node in the stylesheet's tree
|
xmlNodePtr inst; /* the node in the stylesheet's tree
|
||||||
corresponding to this item. */
|
corresponding to this item. */
|
||||||
@ -600,7 +600,7 @@ struct _xsltStylePreComp {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltStyleBasicEmptyItem:
|
* xsltStyleBasicEmptyItem:
|
||||||
*
|
*
|
||||||
* Abstract structure only used as a short-cut for
|
* Abstract structure only used as a short-cut for
|
||||||
* XSLT items with no extra fields.
|
* XSLT items with no extra fields.
|
||||||
* NOTE that it is intended that this structure looks the same as
|
* NOTE that it is intended that this structure looks the same as
|
||||||
@ -615,7 +615,7 @@ struct _xsltStyleBasicEmptyItem {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltStyleBasicExpressionItem:
|
* xsltStyleBasicExpressionItem:
|
||||||
*
|
*
|
||||||
* Abstract structure only used as a short-cut for
|
* Abstract structure only used as a short-cut for
|
||||||
* XSLT items with just an expression.
|
* XSLT items with just an expression.
|
||||||
*/
|
*/
|
||||||
@ -637,7 +637,7 @@ struct _xsltStyleBasicExpressionItem {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltStyleItemElement:
|
* xsltStyleItemElement:
|
||||||
*
|
*
|
||||||
* <!-- Category: instruction -->
|
* <!-- Category: instruction -->
|
||||||
* <xsl:element
|
* <xsl:element
|
||||||
* name = { qname }
|
* name = { qname }
|
||||||
@ -650,11 +650,11 @@ typedef struct _xsltStyleItemElement xsltStyleItemElement;
|
|||||||
typedef xsltStyleItemElement *xsltStyleItemElementPtr;
|
typedef xsltStyleItemElement *xsltStyleItemElementPtr;
|
||||||
|
|
||||||
struct _xsltStyleItemElement {
|
struct _xsltStyleItemElement {
|
||||||
XSLT_ITEM_COMMON_FIELDS
|
XSLT_ITEM_COMMON_FIELDS
|
||||||
|
|
||||||
const xmlChar *use;
|
const xmlChar *use;
|
||||||
int has_use;
|
int has_use;
|
||||||
const xmlChar *name;
|
const xmlChar *name;
|
||||||
int has_name;
|
int has_name;
|
||||||
const xmlChar *ns;
|
const xmlChar *ns;
|
||||||
const xmlChar *nsPrefix;
|
const xmlChar *nsPrefix;
|
||||||
@ -799,7 +799,7 @@ typedef xsltStyleItemCopy *xsltStyleItemCopyPtr;
|
|||||||
struct _xsltStyleItemCopy {
|
struct _xsltStyleItemCopy {
|
||||||
XSLT_ITEM_COMMON_FIELDS
|
XSLT_ITEM_COMMON_FIELDS
|
||||||
const xmlChar *use; /* copy, element */
|
const xmlChar *use; /* copy, element */
|
||||||
int has_use; /* copy, element */
|
int has_use; /* copy, element */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -921,7 +921,7 @@ typedef struct _xsltStyleItemMessage xsltStyleItemMessage;
|
|||||||
typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
|
typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
|
||||||
|
|
||||||
struct _xsltStyleItemMessage {
|
struct _xsltStyleItemMessage {
|
||||||
XSLT_ITEM_COMMON_FIELDS
|
XSLT_ITEM_COMMON_FIELDS
|
||||||
int terminate;
|
int terminate;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -940,7 +940,7 @@ struct _xsltStyleItemDocument {
|
|||||||
TODO: Check if we need. */
|
TODO: Check if we need. */
|
||||||
const xmlChar *filename; /* document URL */
|
const xmlChar *filename; /* document URL */
|
||||||
int has_filename;
|
int has_filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
@ -1010,7 +1010,7 @@ struct _xsltStyleItemParam {
|
|||||||
const xmlChar *name;
|
const xmlChar *name;
|
||||||
int has_name;
|
int has_name;
|
||||||
const xmlChar *ns;
|
const xmlChar *ns;
|
||||||
int has_ns;
|
int has_ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1066,7 +1066,7 @@ struct _xsltStyleItemSort {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltStyleItemWhen:
|
* xsltStyleItemWhen:
|
||||||
*
|
*
|
||||||
* <xsl:when
|
* <xsl:when
|
||||||
* test = boolean-expression>
|
* test = boolean-expression>
|
||||||
* <!-- Content: template -->
|
* <!-- Content: template -->
|
||||||
@ -1149,7 +1149,7 @@ typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
|
|||||||
typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
|
typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
|
||||||
struct _xsltStyleItemExtElement {
|
struct _xsltStyleItemExtElement {
|
||||||
XSLT_ITEM_COMMON_FIELDS
|
XSLT_ITEM_COMMON_FIELDS
|
||||||
xsltElemPreCompPtr item;
|
xsltElemPreCompPtr item;
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -1165,7 +1165,7 @@ struct _xsltEffectiveNs {
|
|||||||
xsltEffectiveNsPtr next; /* next item in the list */
|
xsltEffectiveNsPtr next; /* next item in the list */
|
||||||
const xmlChar *prefix;
|
const xmlChar *prefix;
|
||||||
const xmlChar *nsName;
|
const xmlChar *nsName;
|
||||||
/*
|
/*
|
||||||
* Indicates if eclared on the literal result element; dunno if really
|
* Indicates if eclared on the literal result element; dunno if really
|
||||||
* needed.
|
* needed.
|
||||||
*/
|
*/
|
||||||
@ -1201,7 +1201,7 @@ struct _xsltStyleItemLRElementInfo {
|
|||||||
typedef struct _xsltNsAlias xsltNsAlias;
|
typedef struct _xsltNsAlias xsltNsAlias;
|
||||||
typedef xsltNsAlias *xsltNsAliasPtr;
|
typedef xsltNsAlias *xsltNsAliasPtr;
|
||||||
struct _xsltNsAlias {
|
struct _xsltNsAlias {
|
||||||
xsltNsAliasPtr next; /* next in the list */
|
xsltNsAliasPtr next; /* next in the list */
|
||||||
xmlNsPtr literalNs;
|
xmlNsPtr literalNs;
|
||||||
xmlNsPtr targetNs;
|
xmlNsPtr targetNs;
|
||||||
xmlDocPtr docOfTargetNs;
|
xmlDocPtr docOfTargetNs;
|
||||||
@ -1218,7 +1218,7 @@ struct _xsltNsMap {
|
|||||||
xmlNodePtr elem; /* the element holding the ns-decl */
|
xmlNodePtr elem; /* the element holding the ns-decl */
|
||||||
xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
|
xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
|
||||||
const xmlChar *origNsName; /* the original XML namespace name */
|
const xmlChar *origNsName; /* the original XML namespace name */
|
||||||
const xmlChar *newNsName; /* the mapped XML namespace name */
|
const xmlChar *newNsName; /* the mapped XML namespace name */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1273,13 +1273,13 @@ struct _xsltCompilerNodeInfo {
|
|||||||
/* The current in-scope namespaces */
|
/* The current in-scope namespaces */
|
||||||
xsltNsListContainerPtr inScopeNs;
|
xsltNsListContainerPtr inScopeNs;
|
||||||
/* The current excluded result namespaces */
|
/* The current excluded result namespaces */
|
||||||
xsltPointerListPtr exclResultNs;
|
xsltPointerListPtr exclResultNs;
|
||||||
/* The current extension instruction namespaces */
|
/* The current extension instruction namespaces */
|
||||||
xsltPointerListPtr extElemNs;
|
xsltPointerListPtr extElemNs;
|
||||||
|
|
||||||
/* The current info for literal result elements. */
|
/* The current info for literal result elements. */
|
||||||
xsltStyleItemLRElementInfoPtr litResElemInfo;
|
xsltStyleItemLRElementInfoPtr litResElemInfo;
|
||||||
/*
|
/*
|
||||||
* Set to 1 if in-scope namespaces changed,
|
* Set to 1 if in-scope namespaces changed,
|
||||||
* or excluded result namespaces changed,
|
* or excluded result namespaces changed,
|
||||||
* or extension element namespaces changed.
|
* or extension element namespaces changed.
|
||||||
@ -1294,7 +1294,7 @@ struct _xsltCompilerNodeInfo {
|
|||||||
/* whether the content of an extension element was processed */
|
/* whether the content of an extension element was processed */
|
||||||
int extContentHandled;
|
int extContentHandled;
|
||||||
/* the type of the current child */
|
/* the type of the current child */
|
||||||
xsltStyleType curChildType;
|
xsltStyleType curChildType;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1302,7 +1302,7 @@ struct _xsltCompilerNodeInfo {
|
|||||||
*
|
*
|
||||||
* get pointer to compiler context
|
* get pointer to compiler context
|
||||||
*/
|
*/
|
||||||
#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
|
#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XSLT_ERROR_SEVERITY_ERROR = 0,
|
XSLT_ERROR_SEVERITY_ERROR = 0,
|
||||||
@ -1315,7 +1315,7 @@ struct _xsltCompilerCtxt {
|
|||||||
void *errorCtxt; /* user specific error context */
|
void *errorCtxt; /* user specific error context */
|
||||||
/*
|
/*
|
||||||
* used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
|
* used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
|
||||||
xsltErrorSeverityType errSeverity;
|
xsltErrorSeverityType errSeverity;
|
||||||
int warnings; /* TODO: number of warnings found at
|
int warnings; /* TODO: number of warnings found at
|
||||||
compilation */
|
compilation */
|
||||||
int errors; /* TODO: number of errors found at
|
int errors; /* TODO: number of errors found at
|
||||||
@ -1325,7 +1325,7 @@ struct _xsltCompilerCtxt {
|
|||||||
int simplified; /* whether this is a simplified stylesheet */
|
int simplified; /* whether this is a simplified stylesheet */
|
||||||
/* TODO: structured/unstructured error contexts. */
|
/* TODO: structured/unstructured error contexts. */
|
||||||
int depth; /* Current depth of processing */
|
int depth; /* Current depth of processing */
|
||||||
|
|
||||||
xsltCompilerNodeInfoPtr inode;
|
xsltCompilerNodeInfoPtr inode;
|
||||||
xsltCompilerNodeInfoPtr inodeList;
|
xsltCompilerNodeInfoPtr inodeList;
|
||||||
xsltCompilerNodeInfoPtr inodeLast;
|
xsltCompilerNodeInfoPtr inodeLast;
|
||||||
@ -1338,7 +1338,7 @@ struct _xsltCompilerCtxt {
|
|||||||
in a parsing episode */
|
in a parsing episode */
|
||||||
int maxNodeInfos; /* TEMP TODO: just for the interest */
|
int maxNodeInfos; /* TEMP TODO: just for the interest */
|
||||||
int maxLREs; /* TEMP TODO: just for the interest */
|
int maxLREs; /* TEMP TODO: just for the interest */
|
||||||
/*
|
/*
|
||||||
* In order to keep the old behaviour, applying strict rules of
|
* In order to keep the old behaviour, applying strict rules of
|
||||||
* the spec can be turned off. This has effect only on special
|
* the spec can be turned off. This has effect only on special
|
||||||
* mechanisms like whitespace-stripping in the stylesheet.
|
* mechanisms like whitespace-stripping in the stylesheet.
|
||||||
@ -1353,7 +1353,7 @@ struct _xsltCompilerCtxt {
|
|||||||
xsltNsAliasPtr nsAliases;
|
xsltNsAliasPtr nsAliases;
|
||||||
xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
|
xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
|
||||||
xsltVarInfoPtr ivar; /* topmost local variable/param. */
|
xsltVarInfoPtr ivar; /* topmost local variable/param. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* XSLT_REFACTORED */
|
#else /* XSLT_REFACTORED */
|
||||||
/*
|
/*
|
||||||
@ -1476,7 +1476,7 @@ struct _xsltPrincipalStylesheetData {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Note that we added a @compCtxt field to anchor an stylesheet compilation
|
* Note that we added a @compCtxt field to anchor an stylesheet compilation
|
||||||
@ -1521,7 +1521,7 @@ struct _xsltStylesheet {
|
|||||||
void *textMatch; /* template based on text() */
|
void *textMatch; /* template based on text() */
|
||||||
void *piMatch; /* template based on processing-instruction() */
|
void *piMatch; /* template based on processing-instruction() */
|
||||||
void *commentMatch; /* template based on comment() */
|
void *commentMatch; /* template based on comment() */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Namespace aliases.
|
* Namespace aliases.
|
||||||
* NOTE: Not used in the refactored code.
|
* NOTE: Not used in the refactored code.
|
||||||
@ -1542,7 +1542,7 @@ struct _xsltStylesheet {
|
|||||||
execution of XPath expressions; unfortunately
|
execution of XPath expressions; unfortunately
|
||||||
it restricts the stylesheet to have distinct
|
it restricts the stylesheet to have distinct
|
||||||
prefixes.
|
prefixes.
|
||||||
TODO: We need to get rid of this.
|
TODO: We need to get rid of this.
|
||||||
*/
|
*/
|
||||||
void *nsDefs; /* ATTENTION TODO: This is currently used to store
|
void *nsDefs; /* ATTENTION TODO: This is currently used to store
|
||||||
xsltExtDefPtr (in extensions.c) and
|
xsltExtDefPtr (in extensions.c) and
|
||||||
@ -1563,7 +1563,7 @@ struct _xsltStylesheet {
|
|||||||
xmlChar *encoding; /* encoding string */
|
xmlChar *encoding; /* encoding string */
|
||||||
int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */
|
int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number formatting.
|
* Number formatting.
|
||||||
*/
|
*/
|
||||||
xsltDecimalFormatPtr decimalFormat;
|
xsltDecimalFormatPtr decimalFormat;
|
||||||
@ -1633,7 +1633,7 @@ struct _xsltStylesheet {
|
|||||||
*/
|
*/
|
||||||
xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
|
xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
|
||||||
|
|
||||||
xsltPrincipalStylesheetDataPtr principalData;
|
xsltPrincipalStylesheetDataPtr principalData;
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Forwards-compatible processing
|
* Forwards-compatible processing
|
||||||
@ -1839,62 +1839,62 @@ struct _xsltTransformContext {
|
|||||||
xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
|
xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
|
||||||
xmlChar *name);
|
xmlChar *name);
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltNewStylesheet (void);
|
xsltNewStylesheet (void);
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltParseStylesheetFile (const xmlChar* filename);
|
xsltParseStylesheetFile (const xmlChar* filename);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeStylesheet (xsltStylesheetPtr style);
|
xsltFreeStylesheet (xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltIsBlank (xmlChar *str);
|
xsltIsBlank (xmlChar *str);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltFreeStackElemList (xsltStackElemPtr elem);
|
xsltFreeStackElemList (xsltStackElemPtr elem);
|
||||||
XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
|
XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
|
||||||
xsltDecimalFormatGetByName(xsltStylesheetPtr style,
|
xsltDecimalFormatGetByName(xsltStylesheetPtr style,
|
||||||
xmlChar *name);
|
xmlChar *name);
|
||||||
|
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltParseStylesheetProcess(xsltStylesheetPtr ret,
|
xsltParseStylesheetProcess(xsltStylesheetPtr ret,
|
||||||
xmlDocPtr doc);
|
xmlDocPtr doc);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseStylesheetOutput(xsltStylesheetPtr style,
|
xsltParseStylesheetOutput(xsltStylesheetPtr style,
|
||||||
xmlNodePtr cur);
|
xmlNodePtr cur);
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltParseStylesheetDoc (xmlDocPtr doc);
|
xsltParseStylesheetDoc (xmlDocPtr doc);
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltParseStylesheetImportedDoc(xmlDocPtr doc,
|
xsltParseStylesheetImportedDoc(xmlDocPtr doc,
|
||||||
xsltStylesheetPtr style);
|
xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
XSLTPUBFUN xsltStylesheetPtr XSLTCALL
|
||||||
xsltLoadStylesheetPI (xmlDocPtr doc);
|
xsltLoadStylesheetPI (xmlDocPtr doc);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltNumberFormat (xsltTransformContextPtr ctxt,
|
xsltNumberFormat (xsltTransformContextPtr ctxt,
|
||||||
xsltNumberDataPtr data,
|
xsltNumberDataPtr data,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
XSLTPUBFUN xmlXPathError XSLTCALL
|
XSLTPUBFUN xmlXPathError XSLTCALL
|
||||||
xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
xsltFormatNumberConversion(xsltDecimalFormatPtr self,
|
||||||
xmlChar *format,
|
xmlChar *format,
|
||||||
double number,
|
double number,
|
||||||
xmlChar **result);
|
xmlChar **result);
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseTemplateContent(xsltStylesheetPtr style,
|
xsltParseTemplateContent(xsltStylesheetPtr style,
|
||||||
xmlNodePtr templ);
|
xmlNodePtr templ);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltAllocateExtra (xsltStylesheetPtr style);
|
xsltAllocateExtra (xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt);
|
xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt);
|
||||||
/*
|
/*
|
||||||
* Extra functions for Result Value Trees
|
* Extra functions for Result Value Trees
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||||
xsltCreateRVT (xsltTransformContextPtr ctxt);
|
xsltCreateRVT (xsltTransformContextPtr ctxt);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltRegisterTmpRVT (xsltTransformContextPtr ctxt,
|
xsltRegisterTmpRVT (xsltTransformContextPtr ctxt,
|
||||||
xmlDocPtr RVT);
|
xmlDocPtr RVT);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltRegisterLocalRVT (xsltTransformContextPtr ctxt,
|
xsltRegisterLocalRVT (xsltTransformContextPtr ctxt,
|
||||||
xmlDocPtr RVT);
|
xmlDocPtr RVT);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltRegisterPersistRVT (xsltTransformContextPtr ctxt,
|
xsltRegisterPersistRVT (xsltTransformContextPtr ctxt,
|
||||||
xmlDocPtr RVT);
|
xmlDocPtr RVT);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
@ -1943,7 +1943,7 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltParseSequenceConstructor(
|
xsltParseSequenceConstructor(
|
||||||
xsltCompilerCtxtPtr cctxt,
|
xsltCompilerCtxtPtr cctxt,
|
||||||
|
@ -99,41 +99,41 @@ xsltNewLocale(const xmlChar *languageTag) {
|
|||||||
const char *region = NULL;
|
const char *region = NULL;
|
||||||
char *q = localeName;
|
char *q = localeName;
|
||||||
int i, llen;
|
int i, llen;
|
||||||
|
|
||||||
/* Convert something like "pt-br" to "pt_BR.utf8" */
|
/* Convert something like "pt-br" to "pt_BR.utf8" */
|
||||||
|
|
||||||
if (languageTag == NULL)
|
if (languageTag == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
for (i=0; i<XSLTMAX_ISO639LANGLEN && ISALPHA(*p); ++i)
|
for (i=0; i<XSLTMAX_ISO639LANGLEN && ISALPHA(*p); ++i)
|
||||||
*q++ = TOLOWER(*p++);
|
*q++ = TOLOWER(*p++);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
llen = i;
|
llen = i;
|
||||||
|
|
||||||
if (*p) {
|
if (*p) {
|
||||||
if (*p++ != '-')
|
if (*p++ != '-')
|
||||||
return(NULL);
|
return(NULL);
|
||||||
*q++ = '_';
|
*q++ = '_';
|
||||||
|
|
||||||
for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i)
|
for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i)
|
||||||
*q++ = TOUPPER(*p++);
|
*q++ = TOUPPER(*p++);
|
||||||
|
|
||||||
if (i == 0 || *p)
|
if (i == 0 || *p)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
memcpy(q, ".utf8", 6);
|
memcpy(q, ".utf8", 6);
|
||||||
locale = newlocale(LC_COLLATE_MASK, localeName, NULL);
|
locale = newlocale(LC_COLLATE_MASK, localeName, NULL);
|
||||||
if (locale != NULL)
|
if (locale != NULL)
|
||||||
return(locale);
|
return(locale);
|
||||||
|
|
||||||
/* Continue without using country code */
|
/* Continue without using country code */
|
||||||
|
|
||||||
q = localeName + llen;
|
q = localeName + llen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try locale without territory, e.g. for Esperanto (eo) */
|
/* Try locale without territory, e.g. for Esperanto (eo) */
|
||||||
|
|
||||||
memcpy(q, ".utf8", 6);
|
memcpy(q, ".utf8", 6);
|
||||||
@ -142,21 +142,21 @@ xsltNewLocale(const xmlChar *languageTag) {
|
|||||||
return(locale);
|
return(locale);
|
||||||
|
|
||||||
/* Try to find most common country for language */
|
/* Try to find most common country for language */
|
||||||
|
|
||||||
if (llen != 2)
|
if (llen != 2)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
region = (char *)xsltDefaultRegion((xmlChar *)localeName);
|
region = (char *)xsltDefaultRegion((xmlChar *)localeName);
|
||||||
if (region == NULL)
|
if (region == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
q = localeName + llen;
|
q = localeName + llen;
|
||||||
*q++ = '_';
|
*q++ = '_';
|
||||||
*q++ = region[0];
|
*q++ = region[0];
|
||||||
*q++ = region[1];
|
*q++ = region[1];
|
||||||
memcpy(q, ".utf8", 6);
|
memcpy(q, ".utf8", 6);
|
||||||
locale = newlocale(LC_COLLATE_MASK, localeName, NULL);
|
locale = newlocale(LC_COLLATE_MASK, localeName, NULL);
|
||||||
|
|
||||||
return(locale);
|
return(locale);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ xsltNewLocale(const xmlChar *languageTag) {
|
|||||||
*q++ = '-';
|
*q++ = '-';
|
||||||
if (*p) { /*if country tag is given*/
|
if (*p) { /*if country tag is given*/
|
||||||
if (*p++ != '-') goto end;
|
if (*p++ != '-') goto end;
|
||||||
|
|
||||||
for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i)
|
for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i)
|
||||||
*q++ = TOUPPER(*p++);
|
*q++ = TOUPPER(*p++);
|
||||||
if (i == 0 || *p) goto end;
|
if (i == 0 || *p) goto end;
|
||||||
@ -211,10 +211,10 @@ xsltDefaultRegion(const xmlChar *localeName) {
|
|||||||
xmlChar c;
|
xmlChar c;
|
||||||
/* region should be xmlChar, but gcc warns on all string assignments */
|
/* region should be xmlChar, but gcc warns on all string assignments */
|
||||||
const char *region = NULL;
|
const char *region = NULL;
|
||||||
|
|
||||||
c = localeName[1];
|
c = localeName[1];
|
||||||
/* This is based on the locales from glibc 2.3.3 */
|
/* This is based on the locales from glibc 2.3.3 */
|
||||||
|
|
||||||
switch (localeName[0]) {
|
switch (localeName[0]) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (c == 'a' || c == 'm') region = "ET";
|
if (c == 'a' || c == 'm') region = "ET";
|
||||||
@ -375,7 +375,7 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string)
|
|||||||
#else
|
#else
|
||||||
size_t xstrlen, r;
|
size_t xstrlen, r;
|
||||||
xsltLocaleChar *xstr;
|
xsltLocaleChar *xstr;
|
||||||
|
|
||||||
#ifdef XSLT_LOCALE_XLOCALE
|
#ifdef XSLT_LOCALE_XLOCALE
|
||||||
xstrlen = strxfrm_l(NULL, (const char *)string, 0, locale) + 1;
|
xstrlen = strxfrm_l(NULL, (const char *)string, 0, locale) + 1;
|
||||||
xstr = (xsltLocaleChar *) xmlMalloc(xstrlen);
|
xstr = (xsltLocaleChar *) xmlMalloc(xstrlen);
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Convenience function *
|
* Convenience function *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -326,7 +326,7 @@ error:
|
|||||||
* -1 in case of an error.
|
* -1 in case of an error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xsltPointerListAddSize(xsltPointerListPtr list,
|
xsltPointerListAddSize(xsltPointerListPtr list,
|
||||||
void *item,
|
void *item,
|
||||||
int initialSize)
|
int initialSize)
|
||||||
{
|
{
|
||||||
@ -422,9 +422,9 @@ xsltPointerListClear(xsltPointerListPtr list)
|
|||||||
#endif /* XSLT_REFACTORED */
|
#endif /* XSLT_REFACTORED */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Handling of XSLT stylesheets messages *
|
* Handling of XSLT stylesheets messages *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -477,9 +477,9 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Handling of out of context errors *
|
* Handling of out of context errors *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#define XSLT_GET_VAR_STR(msg, str) { \
|
#define XSLT_GET_VAR_STR(msg, str) { \
|
||||||
@ -489,14 +489,14 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
|
|||||||
va_list ap; \
|
va_list ap; \
|
||||||
\
|
\
|
||||||
str = (char *) xmlMalloc(150); \
|
str = (char *) xmlMalloc(150); \
|
||||||
if (str == NULL) \
|
if (str == NULL) \
|
||||||
return; \
|
return; \
|
||||||
\
|
\
|
||||||
size = 150; \
|
size = 150; \
|
||||||
\
|
\
|
||||||
while (size < 64000) { \
|
while (size < 64000) { \
|
||||||
va_start(ap, msg); \
|
va_start(ap, msg); \
|
||||||
chars = vsnprintf(str, size, msg, ap); \
|
chars = vsnprintf(str, size, msg, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
if ((chars > -1) && (chars < size)) \
|
if ((chars > -1) && (chars < size)) \
|
||||||
break; \
|
break; \
|
||||||
@ -516,7 +516,7 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
|
|||||||
* @ctx: an error context
|
* @ctx: an error context
|
||||||
* @msg: the message to display/transmit
|
* @msg: the message to display/transmit
|
||||||
* @...: extra parameters for the message display
|
* @...: extra parameters for the message display
|
||||||
*
|
*
|
||||||
* Default handler for out of context error messages.
|
* Default handler for out of context error messages.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -562,7 +562,7 @@ xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
|||||||
* @ctx: an error context
|
* @ctx: an error context
|
||||||
* @msg: the message to display/transmit
|
* @msg: the message to display/transmit
|
||||||
* @...: extra parameters for the message display
|
* @...: extra parameters for the message display
|
||||||
*
|
*
|
||||||
* Default handler for out of context error messages.
|
* Default handler for out of context error messages.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -644,8 +644,8 @@ xsltPrintErrorContext(xsltTransformContextPtr ctxt,
|
|||||||
if (node->name != NULL)
|
if (node->name != NULL)
|
||||||
name = node->name;
|
name = node->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctxt != NULL)
|
if (ctxt != NULL)
|
||||||
type = "runtime error";
|
type = "runtime error";
|
||||||
else if (style != NULL) {
|
else if (style != NULL) {
|
||||||
@ -731,9 +731,9 @@ xsltTransformError(xsltTransformContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* QNames *
|
* QNames *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -808,9 +808,9 @@ xsltGetQNameURI(xmlNodePtr node, xmlChar ** name)
|
|||||||
* we are not trying to validate but just to cut, and yes it will
|
* we are not trying to validate but just to cut, and yes it will
|
||||||
* work even if this is a set of UTF-8 encoded chars
|
* work even if this is a set of UTF-8 encoded chars
|
||||||
*/
|
*/
|
||||||
while ((qname[len] != 0) && (qname[len] != ':'))
|
while ((qname[len] != 0) && (qname[len] != ':'))
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if (qname[len] == 0)
|
if (qname[len] == 0)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -915,11 +915,11 @@ xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node,
|
|||||||
xmlFree(qname);
|
xmlFree(qname);
|
||||||
return(ns->href);
|
return(ns->href);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Sorting *
|
* Sorting *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -974,7 +974,7 @@ xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) {
|
|||||||
xmlNodeSetPtr list = NULL;
|
xmlNodeSetPtr list = NULL;
|
||||||
xmlXPathObjectPtr res;
|
xmlXPathObjectPtr res;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i;
|
int i;
|
||||||
xmlNodePtr oldNode;
|
xmlNodePtr oldNode;
|
||||||
xmlNodePtr oldInst;
|
xmlNodePtr oldInst;
|
||||||
int oldPos, oldSize ;
|
int oldPos, oldSize ;
|
||||||
@ -1090,7 +1090,7 @@ xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) {
|
|||||||
* reorder the current node list accordingly to the set of sorting
|
* reorder the current node list accordingly to the set of sorting
|
||||||
* requirement provided by the arry of nodes.
|
* requirement provided by the arry of nodes.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
||||||
int nbsorts) {
|
int nbsorts) {
|
||||||
#ifdef XSLT_REFACTORED
|
#ifdef XSLT_REFACTORED
|
||||||
@ -1107,7 +1107,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
int tst;
|
int tst;
|
||||||
int depth;
|
int depth;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
xmlXPathObjectPtr tmp;
|
xmlXPathObjectPtr tmp;
|
||||||
int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT];
|
int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT];
|
||||||
|
|
||||||
if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) ||
|
if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) ||
|
||||||
@ -1187,7 +1187,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
j = i - incr;
|
j = i - incr;
|
||||||
if (results[i] == NULL)
|
if (results[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
while (j >= 0) {
|
while (j >= 0) {
|
||||||
if (results[j] == NULL)
|
if (results[j] == NULL)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
@ -1205,7 +1205,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
else if (results[j]->floatval ==
|
else if (results[j]->floatval ==
|
||||||
results[j + incr]->floatval)
|
results[j + incr]->floatval)
|
||||||
tst = 0;
|
tst = 0;
|
||||||
else if (results[j]->floatval >
|
else if (results[j]->floatval >
|
||||||
results[j + incr]->floatval)
|
results[j + incr]->floatval)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
else tst = -1;
|
else tst = -1;
|
||||||
@ -1213,10 +1213,10 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
tst = xsltLocaleStrcmp(
|
tst = xsltLocaleStrcmp(
|
||||||
comp->locale,
|
comp->locale,
|
||||||
(xsltLocaleChar *) results[j]->stringval,
|
(xsltLocaleChar *) results[j]->stringval,
|
||||||
(xsltLocaleChar *) results[j + incr]->stringval);
|
(xsltLocaleChar *) results[j + incr]->stringval);
|
||||||
} else {
|
} else {
|
||||||
tst = xmlStrcmp(results[j]->stringval,
|
tst = xmlStrcmp(results[j]->stringval,
|
||||||
results[j + incr]->stringval);
|
results[j + incr]->stringval);
|
||||||
}
|
}
|
||||||
if (descending)
|
if (descending)
|
||||||
tst = -tst;
|
tst = -tst;
|
||||||
@ -1239,11 +1239,11 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
* Compute the result of the next level for the
|
* Compute the result of the next level for the
|
||||||
* full set, this might be optimized ... or not
|
* full set, this might be optimized ... or not
|
||||||
*/
|
*/
|
||||||
if (resultsTab[depth] == NULL)
|
if (resultsTab[depth] == NULL)
|
||||||
resultsTab[depth] = xsltComputeSortResult(ctxt,
|
resultsTab[depth] = xsltComputeSortResult(ctxt,
|
||||||
sorts[depth]);
|
sorts[depth]);
|
||||||
res = resultsTab[depth];
|
res = resultsTab[depth];
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
break;
|
break;
|
||||||
if (res[j] == NULL) {
|
if (res[j] == NULL) {
|
||||||
if (res[j+incr] != NULL)
|
if (res[j+incr] != NULL)
|
||||||
@ -1254,7 +1254,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
accordance with XSLT spec */
|
accordance with XSLT spec */
|
||||||
if (xmlXPathIsNaN(res[j]->floatval)) {
|
if (xmlXPathIsNaN(res[j]->floatval)) {
|
||||||
if (xmlXPathIsNaN(res[j +
|
if (xmlXPathIsNaN(res[j +
|
||||||
incr]->floatval))
|
incr]->floatval))
|
||||||
tst = 0;
|
tst = 0;
|
||||||
else
|
else
|
||||||
tst = -1;
|
tst = -1;
|
||||||
@ -1264,7 +1264,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
else if (res[j]->floatval == res[j + incr]->
|
else if (res[j]->floatval == res[j + incr]->
|
||||||
floatval)
|
floatval)
|
||||||
tst = 0;
|
tst = 0;
|
||||||
else if (res[j]->floatval >
|
else if (res[j]->floatval >
|
||||||
res[j + incr]->floatval)
|
res[j + incr]->floatval)
|
||||||
tst = 1;
|
tst = 1;
|
||||||
else tst = -1;
|
else tst = -1;
|
||||||
@ -1272,10 +1272,10 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
|||||||
tst = xsltLocaleStrcmp(
|
tst = xsltLocaleStrcmp(
|
||||||
comp->locale,
|
comp->locale,
|
||||||
(xsltLocaleChar *) res[j]->stringval,
|
(xsltLocaleChar *) res[j]->stringval,
|
||||||
(xsltLocaleChar *) res[j + incr]->stringval);
|
(xsltLocaleChar *) res[j + incr]->stringval);
|
||||||
} else {
|
} else {
|
||||||
tst = xmlStrcmp(res[j]->stringval,
|
tst = xmlStrcmp(res[j]->stringval,
|
||||||
res[j + incr]->stringval);
|
res[j + incr]->stringval);
|
||||||
}
|
}
|
||||||
if (desc)
|
if (desc)
|
||||||
tst = -tst;
|
tst = -tst;
|
||||||
@ -1387,32 +1387,32 @@ xsltSetSortFunc(xsltSortFunc handler) {
|
|||||||
* @handler: the new handler function
|
* @handler: the new handler function
|
||||||
*
|
*
|
||||||
* Function to set the handler for XSLT sorting
|
* Function to set the handler for XSLT sorting
|
||||||
* for the specified context.
|
* for the specified context.
|
||||||
* If the handler is NULL, then the global
|
* If the handler is NULL, then the global
|
||||||
* sort function will be called
|
* sort function will be called
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) {
|
xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) {
|
||||||
ctxt->sortfunc = handler;
|
ctxt->sortfunc = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Parsing options *
|
* Parsing options *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltSetCtxtParseOptions:
|
* xsltSetCtxtParseOptions:
|
||||||
* @ctxt: a XSLT process context
|
* @ctxt: a XSLT process context
|
||||||
* @options: a combination of libxml2 xmlParserOption
|
* @options: a combination of libxml2 xmlParserOption
|
||||||
*
|
*
|
||||||
* Change the default parser option passed by the XSLT engine to the
|
* Change the default parser option passed by the XSLT engine to the
|
||||||
* parser when using document() loading.
|
* parser when using document() loading.
|
||||||
*
|
*
|
||||||
* Returns the previous options or -1 in case of error
|
* Returns the previous options or -1 in case of error
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options)
|
xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options)
|
||||||
{
|
{
|
||||||
int oldopts;
|
int oldopts;
|
||||||
@ -1431,9 +1431,9 @@ xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Output *
|
* Output *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1524,7 +1524,7 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
|
|||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cur = cur->parent;
|
cur = cur->parent;
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
@ -1745,7 +1745,7 @@ xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) {
|
|||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
|
xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
|
||||||
xmlDocPtr result, xsltStylesheetPtr style) {
|
xmlDocPtr result, xsltStylesheetPtr style) {
|
||||||
xmlOutputBufferPtr buf;
|
xmlOutputBufferPtr buf;
|
||||||
const xmlChar *encoding;
|
const xmlChar *encoding;
|
||||||
@ -1793,9 +1793,9 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Generating profiling informations *
|
* Generating profiling informations *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static long calibration = -1;
|
static long calibration = -1;
|
||||||
@ -1912,7 +1912,7 @@ xsltTimestamp(void)
|
|||||||
tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
|
tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC;
|
||||||
tics += (cur.tv_usec - startup.tv_usec) /
|
tics += (cur.tv_usec - startup.tv_usec) /
|
||||||
(1000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
|
(1000000l / XSLT_TIMESTAMP_TICS_PER_SEC);
|
||||||
|
|
||||||
tics -= calibration;
|
tics -= calibration;
|
||||||
return(tics);
|
return(tics);
|
||||||
#else
|
#else
|
||||||
@ -1930,7 +1930,7 @@ pretty_templ_match(xsltTemplatePtr templ) {
|
|||||||
static char dst[1001];
|
static char dst[1001];
|
||||||
char *src = (char *)templ->match;
|
char *src = (char *)templ->match;
|
||||||
int i=0,j;
|
int i=0,j;
|
||||||
|
|
||||||
/* strip white spaces */
|
/* strip white spaces */
|
||||||
for (j=0; i<1000 && src[j]; i++,j++) {
|
for (j=0; i<1000 && src[j]; i++,j++) {
|
||||||
for(;src[j]==' ';j++);
|
for(;src[j]==' ';j++);
|
||||||
@ -2055,11 +2055,11 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
childt = xmlMalloc((nb + 1) * sizeof(int));
|
childt = xmlMalloc((nb + 1) * sizeof(int));
|
||||||
if (childt == NULL)
|
if (childt == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* precalculate children times */
|
/* precalculate children times */
|
||||||
for (i = 0; i < nb; i++) {
|
for (i = 0; i < nb; i++) {
|
||||||
templ1 = templates[i];
|
templ1 = templates[i];
|
||||||
|
|
||||||
childt[i] = 0;
|
childt[i] = 0;
|
||||||
for (k = 0; k < nb; k++) {
|
for (k = 0; k < nb; k++) {
|
||||||
templ2 = templates[k];
|
templ2 = templates[k];
|
||||||
@ -2071,9 +2071,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
childt[i] = 0;
|
childt[i] = 0;
|
||||||
|
|
||||||
fprintf(output, "\nindex %% time self children called name\n");
|
fprintf(output, "\nindex %% time self children called name\n");
|
||||||
|
|
||||||
for (i = 0; i < nb; i++) {
|
for (i = 0; i < nb; i++) {
|
||||||
char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20];
|
char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20];
|
||||||
int t;
|
int t;
|
||||||
@ -2103,7 +2103,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
sprintf(times_str,"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC);
|
sprintf(times_str,"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC);
|
||||||
sprintf(timec_str,"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC);
|
sprintf(timec_str,"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC);
|
||||||
fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n",
|
fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n",
|
||||||
ix_str, timep_str,times_str,timec_str,
|
ix_str, timep_str,times_str,timec_str,
|
||||||
templ1->nbCalls,
|
templ1->nbCalls,
|
||||||
templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i);
|
templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i);
|
||||||
/* callees
|
/* callees
|
||||||
@ -2136,7 +2136,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
}
|
}
|
||||||
fprintf(output, "-----------------------------------------------\n");
|
fprintf(output, "-----------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(output, "\f\nIndex by function name\n");
|
fprintf(output, "\f\nIndex by function name\n");
|
||||||
for (i = 0; i < nb; i++) {
|
for (i = 0; i < nb; i++) {
|
||||||
templ1 = templates[i];
|
templ1 = templates[i];
|
||||||
@ -2144,7 +2144,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1),
|
i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1),
|
||||||
templ1->style->doc->URL,templ1->elem->line);
|
templ1->style->doc->URL,templ1->elem->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(output, "\f\n");
|
fprintf(output, "\f\n");
|
||||||
xmlFree(childt);
|
xmlFree(childt);
|
||||||
|
|
||||||
@ -2152,9 +2152,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Fetching profiling informations *
|
* Fetching profiling informations *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2267,9 +2267,9 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Hooks for libxml2 XPath *
|
* Hooks for libxml2 XPath *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2354,9 +2354,9 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Hooks for the debugger *
|
* Hooks for the debugger *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2384,18 +2384,18 @@ int xslDebugStatus;
|
|||||||
/**
|
/**
|
||||||
* xsltSetDebuggerStatus:
|
* xsltSetDebuggerStatus:
|
||||||
* @value : the value to be set
|
* @value : the value to be set
|
||||||
*
|
*
|
||||||
* This function sets the value of xslDebugStatus.
|
* This function sets the value of xslDebugStatus.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xsltSetDebuggerStatus(int value)
|
xsltSetDebuggerStatus(int value)
|
||||||
{
|
{
|
||||||
xslDebugStatus = value;
|
xslDebugStatus = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltGetDebuggerStatus:
|
* xsltGetDebuggerStatus:
|
||||||
*
|
*
|
||||||
* Get xslDebugStatus.
|
* Get xslDebugStatus.
|
||||||
*
|
*
|
||||||
* Returns the value of xslDebugStatus.
|
* Returns the value of xslDebugStatus.
|
||||||
@ -2403,16 +2403,16 @@ xsltSetDebuggerStatus(int value)
|
|||||||
int
|
int
|
||||||
xsltGetDebuggerStatus(void)
|
xsltGetDebuggerStatus(void)
|
||||||
{
|
{
|
||||||
return(xslDebugStatus);
|
return(xslDebugStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xsltSetDebuggerCallbacks:
|
* xsltSetDebuggerCallbacks:
|
||||||
* @no : number of callbacks
|
* @no : number of callbacks
|
||||||
* @block : the block of callbacks
|
* @block : the block of callbacks
|
||||||
*
|
*
|
||||||
* This function allow to plug a debugger into the XSLT library
|
* This function allow to plug a debugger into the XSLT library
|
||||||
* @block points to a block of memory containing the address of @no
|
* @block points to a block of memory containing the address of @no
|
||||||
* callback routines.
|
* callback routines.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@ -2437,9 +2437,9 @@ xsltSetDebuggerCallbacks(int no, void *block)
|
|||||||
* @cur : source node being executed
|
* @cur : source node being executed
|
||||||
* @node : data node being processed
|
* @node : data node being processed
|
||||||
* @templ : temlate that applies to node
|
* @templ : temlate that applies to node
|
||||||
* @ctxt : the xslt transform context
|
* @ctxt : the xslt transform context
|
||||||
*
|
*
|
||||||
* If either cur or node are a breakpoint, or xslDebugStatus in state
|
* If either cur or node are a breakpoint, or xslDebugStatus in state
|
||||||
* where debugging must occcur at this time then transfer control
|
* where debugging must occcur at this time then transfer control
|
||||||
* to the xslDebugBreak function
|
* to the xslDebugBreak function
|
||||||
*/
|
*/
|
||||||
@ -2457,7 +2457,7 @@ xslHandleDebugger(xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ,
|
|||||||
* @source : the source node being processed
|
* @source : the source node being processed
|
||||||
*
|
*
|
||||||
* Add template "call" to call stack
|
* Add template "call" to call stack
|
||||||
* Returns : 1 on sucess 0 otherwise an error may be printed if
|
* Returns : 1 on sucess 0 otherwise an error may be printed if
|
||||||
* WITH_XSLT_DEBUG_BREAKPOINTS is defined
|
* WITH_XSLT_DEBUG_BREAKPOINTS is defined
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* Macro to flag unimplemented blocks.
|
* Macro to flag unimplemented blocks.
|
||||||
*/
|
*/
|
||||||
#define XSLT_TODO \
|
#define XSLT_TODO \
|
||||||
xsltGenericError(xsltGenericErrorContext, \
|
xsltGenericError(xsltGenericErrorContext, \
|
||||||
"Unimplemented block at %s:%d\n", \
|
"Unimplemented block at %s:%d\n", \
|
||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
@ -41,7 +41,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* Macro to flag that a problem was detected internally.
|
* Macro to flag that a problem was detected internally.
|
||||||
*/
|
*/
|
||||||
#define XSLT_STRANGE \
|
#define XSLT_STRANGE \
|
||||||
xsltGenericError(xsltGenericErrorContext, \
|
xsltGenericError(xsltGenericErrorContext, \
|
||||||
"Internal error at %s:%d\n", \
|
"Internal error at %s:%d\n", \
|
||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
@ -77,7 +77,7 @@ extern "C" {
|
|||||||
((n)->type == XML_DOCUMENT_NODE) || \
|
((n)->type == XML_DOCUMENT_NODE) || \
|
||||||
((n)->type == XML_HTML_DOCUMENT_NODE) || \
|
((n)->type == XML_HTML_DOCUMENT_NODE) || \
|
||||||
((n)->type == XML_COMMENT_NODE) || \
|
((n)->type == XML_COMMENT_NODE) || \
|
||||||
((n)->type == XML_PI_NODE)))
|
((n)->type == XML_PI_NODE)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Our own version of namespaced atributes lookup.
|
* Our own version of namespaced atributes lookup.
|
||||||
@ -100,24 +100,24 @@ XSLTPUBFUN int XSLTCALL
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XSLT_TRACE_ALL = -1,
|
XSLT_TRACE_ALL = -1,
|
||||||
XSLT_TRACE_NONE = 0,
|
XSLT_TRACE_NONE = 0,
|
||||||
XSLT_TRACE_COPY_TEXT = 1<<0,
|
XSLT_TRACE_COPY_TEXT = 1<<0,
|
||||||
XSLT_TRACE_PROCESS_NODE = 1<<1,
|
XSLT_TRACE_PROCESS_NODE = 1<<1,
|
||||||
XSLT_TRACE_APPLY_TEMPLATE = 1<<2,
|
XSLT_TRACE_APPLY_TEMPLATE = 1<<2,
|
||||||
XSLT_TRACE_COPY = 1<<3,
|
XSLT_TRACE_COPY = 1<<3,
|
||||||
XSLT_TRACE_COMMENT = 1<<4,
|
XSLT_TRACE_COMMENT = 1<<4,
|
||||||
XSLT_TRACE_PI = 1<<5,
|
XSLT_TRACE_PI = 1<<5,
|
||||||
XSLT_TRACE_COPY_OF = 1<<6,
|
XSLT_TRACE_COPY_OF = 1<<6,
|
||||||
XSLT_TRACE_VALUE_OF = 1<<7,
|
XSLT_TRACE_VALUE_OF = 1<<7,
|
||||||
XSLT_TRACE_CALL_TEMPLATE = 1<<8,
|
XSLT_TRACE_CALL_TEMPLATE = 1<<8,
|
||||||
XSLT_TRACE_APPLY_TEMPLATES = 1<<9,
|
XSLT_TRACE_APPLY_TEMPLATES = 1<<9,
|
||||||
XSLT_TRACE_CHOOSE = 1<<10,
|
XSLT_TRACE_CHOOSE = 1<<10,
|
||||||
XSLT_TRACE_IF = 1<<11,
|
XSLT_TRACE_IF = 1<<11,
|
||||||
XSLT_TRACE_FOR_EACH = 1<<12,
|
XSLT_TRACE_FOR_EACH = 1<<12,
|
||||||
XSLT_TRACE_STRIP_SPACES = 1<<13,
|
XSLT_TRACE_STRIP_SPACES = 1<<13,
|
||||||
XSLT_TRACE_TEMPLATES = 1<<14,
|
XSLT_TRACE_TEMPLATES = 1<<14,
|
||||||
XSLT_TRACE_KEYS = 1<<15,
|
XSLT_TRACE_KEYS = 1<<15,
|
||||||
XSLT_TRACE_VARIABLES = 1<<16
|
XSLT_TRACE_VARIABLES = 1<<16
|
||||||
} xsltDebugTraceCodes;
|
} xsltDebugTraceCodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,26 +142,26 @@ XSLTPUBVAR void *xsltGenericErrorContext;
|
|||||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
|
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
|
||||||
XSLTPUBVAR void *xsltGenericDebugContext;
|
XSLTPUBVAR void *xsltGenericDebugContext;
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
|
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
|
||||||
xsltStylesheetPtr style,
|
xsltStylesheetPtr style,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltMessage (xsltTransformContextPtr ctxt,
|
xsltMessage (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr inst);
|
xmlNodePtr inst);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetGenericErrorFunc (void *ctx,
|
xsltSetGenericErrorFunc (void *ctx,
|
||||||
xmlGenericErrorFunc handler);
|
xmlGenericErrorFunc handler);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetGenericDebugFunc (void *ctx,
|
xsltSetGenericDebugFunc (void *ctx,
|
||||||
xmlGenericErrorFunc handler);
|
xmlGenericErrorFunc handler);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
|
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
|
||||||
void *ctx,
|
void *ctx,
|
||||||
xmlGenericErrorFunc handler);
|
xmlGenericErrorFunc handler);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltTransformError (xsltTransformContextPtr ctxt,
|
xsltTransformError (xsltTransformContextPtr ctxt,
|
||||||
xsltStylesheetPtr style,
|
xsltStylesheetPtr style,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
@ -174,23 +174,23 @@ XSLTPUBFUN int XSLTCALL
|
|||||||
* Sorting.
|
* Sorting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltDocumentSortFunction (xmlNodeSetPtr list);
|
xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetSortFunc (xsltSortFunc handler);
|
xsltSetSortFunc (xsltSortFunc handler);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||||
xsltSortFunc handler);
|
xsltSortFunc handler);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr *sorts,
|
xmlNodePtr *sorts,
|
||||||
int nbsorts);
|
int nbsorts);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltDoSortFunction (xsltTransformContextPtr ctxt,
|
xsltDoSortFunction (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr * sorts,
|
xmlNodePtr * sorts,
|
||||||
int nbsorts);
|
int nbsorts);
|
||||||
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
|
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
|
||||||
xsltComputeSortResult (xsltTransformContextPtr ctxt,
|
xsltComputeSortResult (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr sort);
|
xmlNodePtr sort);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -201,8 +201,8 @@ XSLTPUBFUN const xmlChar * XSLTCALL
|
|||||||
xsltSplitQName (xmlDictPtr dict,
|
xsltSplitQName (xmlDictPtr dict,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar **prefix);
|
const xmlChar **prefix);
|
||||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||||
xsltGetQNameURI (xmlNodePtr node,
|
xsltGetQNameURI (xmlNodePtr node,
|
||||||
xmlChar **name);
|
xmlChar **name);
|
||||||
|
|
||||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||||
@ -213,27 +213,27 @@ XSLTPUBFUN const xmlChar * XSLTCALL
|
|||||||
/*
|
/*
|
||||||
* Output, reuse libxml I/O buffers.
|
* Output, reuse libxml I/O buffers.
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSaveResultTo (xmlOutputBufferPtr buf,
|
xsltSaveResultTo (xmlOutputBufferPtr buf,
|
||||||
xmlDocPtr result,
|
xmlDocPtr result,
|
||||||
xsltStylesheetPtr style);
|
xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSaveResultToFilename (const char *URI,
|
xsltSaveResultToFilename (const char *URI,
|
||||||
xmlDocPtr result,
|
xmlDocPtr result,
|
||||||
xsltStylesheetPtr style,
|
xsltStylesheetPtr style,
|
||||||
int compression);
|
int compression);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSaveResultToFile (FILE *file,
|
xsltSaveResultToFile (FILE *file,
|
||||||
xmlDocPtr result,
|
xmlDocPtr result,
|
||||||
xsltStylesheetPtr style);
|
xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSaveResultToFd (int fd,
|
xsltSaveResultToFd (int fd,
|
||||||
xmlDocPtr result,
|
xmlDocPtr result,
|
||||||
xsltStylesheetPtr style);
|
xsltStylesheetPtr style);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSaveResultToString (xmlChar **doc_txt_ptr,
|
xsltSaveResultToString (xmlChar **doc_txt_ptr,
|
||||||
int * doc_txt_len,
|
int * doc_txt_len,
|
||||||
xmlDocPtr result,
|
xmlDocPtr result,
|
||||||
xsltStylesheetPtr style);
|
xsltStylesheetPtr style);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -250,16 +250,16 @@ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
|
|||||||
/*
|
/*
|
||||||
* Profiling.
|
* Profiling.
|
||||||
*/
|
*/
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltSaveProfiling (xsltTransformContextPtr ctxt,
|
xsltSaveProfiling (xsltTransformContextPtr ctxt,
|
||||||
FILE *output);
|
FILE *output);
|
||||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||||
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
|
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
|
||||||
|
|
||||||
XSLTPUBFUN long XSLTCALL
|
XSLTPUBFUN long XSLTCALL
|
||||||
xsltTimestamp (void);
|
xsltTimestamp (void);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xsltCalibrateAdjust (long delta);
|
xsltCalibrateAdjust (long delta);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XSLT_TIMESTAMP_TICS_PER_SEC:
|
* XSLT_TIMESTAMP_TICS_PER_SEC:
|
||||||
@ -296,12 +296,12 @@ XSLTPUBFUN void XSLTCALL
|
|||||||
xsltSetDebuggerStatus (int value);
|
xsltSetDebuggerStatus (int value);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltGetDebuggerStatus (void);
|
xsltGetDebuggerStatus (void);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xsltSetDebuggerCallbacks (int no, void *block);
|
xsltSetDebuggerCallbacks (int no, void *block);
|
||||||
XSLTPUBFUN int XSLTCALL
|
XSLTPUBFUN int XSLTCALL
|
||||||
xslAddCall (xsltTemplatePtr templ,
|
xslAddCall (xsltTemplatePtr templ,
|
||||||
xmlNodePtr source);
|
xmlNodePtr source);
|
||||||
XSLTPUBFUN void XSLTCALL
|
XSLTPUBFUN void XSLTCALL
|
||||||
xslDropCall (void);
|
xslDropCall (void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Summary: compile-time version informations for the XSLT engine
|
* Summary: compile-time version informations for the XSLT engine
|
||||||
* when compiled on windows
|
* when compiled on windows
|
||||||
* Description: compile-time version informations for the XSLT engine
|
* Description: compile-time version informations for the XSLT engine
|
||||||
* when compiled on windows. This file is generated.
|
* when compiled on windows. This file is generated.
|
||||||
|
@ -100,7 +100,7 @@ libxslt_xsltGetTransformContextHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObjec
|
|||||||
long hash_code;
|
long hash_code;
|
||||||
xsltTransformContextPtr tctxt;
|
xsltTransformContextPtr tctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:getTransformContextHashCode",
|
if (!PyArg_ParseTuple(args, (char *)"O:getTransformContextHashCode",
|
||||||
&py_tctxt))
|
&py_tctxt))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -113,11 +113,11 @@ libxslt_xsltGetTransformContextHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObjec
|
|||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libxslt_xsltCompareTransformContextsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libxslt_xsltCompareTransformContextsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
|
|
||||||
PyObject *py_tctxt1, *py_tctxt2;
|
PyObject *py_tctxt1, *py_tctxt2;
|
||||||
xsltTransformContextPtr tctxt1, tctxt2;
|
xsltTransformContextPtr tctxt1, tctxt2;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OO:compareTransformContextsEqual",
|
if (!PyArg_ParseTuple(args, (char *)"OO:compareTransformContextsEqual",
|
||||||
&py_tctxt1, &py_tctxt2))
|
&py_tctxt1, &py_tctxt2))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ libxslt_xsltGetStylesheetHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
|
|||||||
long hash_code;
|
long hash_code;
|
||||||
xsltStylesheetPtr style;
|
xsltStylesheetPtr style;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:getStylesheetHashCode",
|
if (!PyArg_ParseTuple(args, (char *)"O:getStylesheetHashCode",
|
||||||
&py_style))
|
&py_style))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -151,11 +151,11 @@ libxslt_xsltGetStylesheetHashCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
|
|||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libxslt_xsltCompareStylesheetsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libxslt_xsltCompareStylesheetsEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
|
|
||||||
PyObject *py_style1, *py_style2;
|
PyObject *py_style1, *py_style2;
|
||||||
xsltStylesheetPtr style1, style2;
|
xsltStylesheetPtr style1, style2;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OO:compareStylesheetsEqual",
|
if (!PyArg_ParseTuple(args, (char *)"OO:compareStylesheetsEqual",
|
||||||
&py_style1, &py_style2))
|
&py_style1, &py_style2))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -240,12 +240,12 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
|
|
||||||
if (style == NULL)
|
if (style == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (inst != NULL && inst->ns != NULL) {
|
if (inst != NULL && inst->ns != NULL) {
|
||||||
name = inst->name;
|
name = inst->name;
|
||||||
ns_uri = inst->ns->href;
|
ns_uri = inst->ns->href;
|
||||||
} else {
|
} else {
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
"libxslt_xsltElementPreCompCallback: internal error bad parameter\n");
|
"libxslt_xsltElementPreCompCallback: internal error bad parameter\n");
|
||||||
printf("libxslt_xsltElementPreCompCallback: internal error bad parameter\n");
|
printf("libxslt_xsltElementPreCompCallback: internal error bad parameter\n");
|
||||||
if (style != NULL) style->errors++;
|
if (style != NULL) style->errors++;
|
||||||
@ -258,7 +258,7 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
pyobj_precomp_f = xmlHashLookup2(libxslt_extModuleElementPreComp,
|
pyobj_precomp_f = xmlHashLookup2(libxslt_extModuleElementPreComp,
|
||||||
name, ns_uri);
|
name, ns_uri);
|
||||||
if (pyobj_precomp_f == NULL) {
|
if (pyobj_precomp_f == NULL) {
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
"libxslt_xsltElementPreCompCallback: internal error, could not find precompile python function!\n");
|
"libxslt_xsltElementPreCompCallback: internal error, could not find precompile python function!\n");
|
||||||
if (style != NULL) style->errors++;
|
if (style != NULL) style->errors++;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -267,13 +267,13 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
pyobj_element_f = xmlHashLookup2(libxslt_extModuleElements,
|
pyobj_element_f = xmlHashLookup2(libxslt_extModuleElements,
|
||||||
name, ns_uri);
|
name, ns_uri);
|
||||||
if (pyobj_element_f == NULL) {
|
if (pyobj_element_f == NULL) {
|
||||||
xsltTransformError(NULL, style, inst,
|
xsltTransformError(NULL, style, inst,
|
||||||
"libxslt_xsltElementPreCompCallback: internal error, could not find element python function!\n");
|
"libxslt_xsltElementPreCompCallback: internal error, could not find element python function!\n");
|
||||||
if (style != NULL) style->errors++;
|
if (style != NULL) style->errors++;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
args = Py_BuildValue((char *)"(OOO)",
|
args = Py_BuildValue((char *)"(OOO)",
|
||||||
libxslt_xsltStylesheetPtrWrap(style),
|
libxslt_xsltStylesheetPtrWrap(style),
|
||||||
libxml_xmlNodePtrWrap(inst),
|
libxml_xmlNodePtrWrap(inst),
|
||||||
pyobj_element_f);
|
pyobj_element_f);
|
||||||
@ -295,9 +295,9 @@ libxslt_xsltElementPreCompCallback(xsltStylesheetPtr style, xmlNodePtr inst,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt,
|
libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr inst,
|
xmlNodePtr inst,
|
||||||
xsltElemPreCompPtr comp)
|
xsltElemPreCompPtr comp)
|
||||||
{
|
{
|
||||||
PyObject *args, *result;
|
PyObject *args, *result;
|
||||||
PyObject *func = NULL;
|
PyObject *func = NULL;
|
||||||
@ -306,7 +306,7 @@ libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt,
|
|||||||
|
|
||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inst != NULL && inst->name != NULL && inst->ns != NULL && inst->ns->href != NULL) {
|
if (inst != NULL && inst->name != NULL && inst->ns != NULL && inst->ns->href != NULL) {
|
||||||
name = inst->name;
|
name = inst->name;
|
||||||
ns_uri = inst->ns->href;
|
ns_uri = inst->ns->href;
|
||||||
@ -331,10 +331,10 @@ libxslt_xsltElementTransformCallback(xsltTransformContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
args = Py_BuildValue((char *)"OOOO",
|
args = Py_BuildValue((char *)"OOOO",
|
||||||
libxslt_xsltTransformContextPtrWrap(ctxt),
|
libxslt_xsltTransformContextPtrWrap(ctxt),
|
||||||
libxml_xmlNodePtrWrap(node),
|
libxml_xmlNodePtrWrap(node),
|
||||||
libxml_xmlNodePtrWrap(inst),
|
libxml_xmlNodePtrWrap(inst),
|
||||||
libxslt_xsltElemPreCompPtrWrap(comp));
|
libxslt_xsltElemPreCompPtrWrap(comp));
|
||||||
|
|
||||||
Py_INCREF(func); /* Protect refcount against reentrant manipulation of callback hash */
|
Py_INCREF(func); /* Protect refcount against reentrant manipulation of callback hash */
|
||||||
result = PyEval_CallObject(func, args);
|
result = PyEval_CallObject(func, args);
|
||||||
@ -401,7 +401,7 @@ libxslt_xsltRegisterExtModuleElement(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
Py_XINCREF(pyobj_precomp_f);
|
Py_XINCREF(pyobj_precomp_f);
|
||||||
|
|
||||||
ret = xsltRegisterExtModuleElement(name, ns_uri,
|
ret = xsltRegisterExtModuleElement(name, ns_uri,
|
||||||
libxslt_xsltElementPreCompCallback,
|
libxslt_xsltElementPreCompCallback,
|
||||||
libxslt_xsltElementTransformCallback);
|
libxslt_xsltElementTransformCallback);
|
||||||
py_retval = libxml_intWrap((int) ret);
|
py_retval = libxml_intWrap((int) ret);
|
||||||
@ -495,7 +495,7 @@ libxslt_xsltRegisterExtModuleFunction(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
Py_XINCREF(pyobj_f);
|
Py_XINCREF(pyobj_f);
|
||||||
|
|
||||||
ret = xsltRegisterExtModuleFunction(name, ns_uri,
|
ret = xsltRegisterExtModuleFunction(name, ns_uri,
|
||||||
libxslt_xmlXPathFuncCallback);
|
libxslt_xmlXPathFuncCallback);
|
||||||
py_retval = libxml_intWrap((int) ret);
|
py_retval = libxml_intWrap((int) ret);
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
@ -536,7 +536,7 @@ pythonDocLoaderFuncWrapper(const xmlChar * URI, xmlDictPtr dict, int options,
|
|||||||
xmlCtxtUseOptions(pctxt, options);
|
xmlCtxtUseOptions(pctxt, options);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now pass to python the URI, the xsltParserContext and the context
|
* Now pass to python the URI, the xsltParserContext and the context
|
||||||
* (either a transformContext or a stylesheet) and get back an xmlDocPtr
|
* (either a transformContext or a stylesheet) and get back an xmlDocPtr
|
||||||
*/
|
*/
|
||||||
if (pythonDocLoaderObject != NULL) {
|
if (pythonDocLoaderObject != NULL) {
|
||||||
@ -545,13 +545,13 @@ pythonDocLoaderFuncWrapper(const xmlChar * URI, xmlDictPtr dict, int options,
|
|||||||
|
|
||||||
if (type == XSLT_LOAD_DOCUMENT) {
|
if (type == XSLT_LOAD_DOCUMENT) {
|
||||||
ctxtobj = libxslt_xsltTransformContextPtrWrap(ctxt);
|
ctxtobj = libxslt_xsltTransformContextPtrWrap(ctxt);
|
||||||
result = PyObject_CallFunction(pythonDocLoaderObject,
|
result = PyObject_CallFunction(pythonDocLoaderObject,
|
||||||
(char *) "(sOOi)", URI, pctxtobj, ctxtobj, 0);
|
(char *) "(sOOi)", URI, pctxtobj, ctxtobj, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ctxtobj = libxslt_xsltStylesheetPtrWrap(ctxt);
|
ctxtobj = libxslt_xsltStylesheetPtrWrap(ctxt);
|
||||||
result = PyObject_CallFunction(pythonDocLoaderObject,
|
result = PyObject_CallFunction(pythonDocLoaderObject,
|
||||||
(char *) "(sOOi)", URI, pctxtobj, ctxtobj, 1);
|
(char *) "(sOOi)", URI, pctxtobj, ctxtobj, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_XDECREF(pctxtobj);
|
Py_XDECREF(pctxtobj);
|
||||||
@ -599,7 +599,7 @@ libxslt_xsltSetLoaderFunc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
xsltSetLoaderFunc(pythonDocLoaderFuncWrapper);
|
xsltSetLoaderFunc(pythonDocLoaderFuncWrapper);
|
||||||
|
|
||||||
py_retval = PyInt_FromLong(0);
|
py_retval = PyInt_FromLong(0);
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
@ -607,7 +607,7 @@ libxslt_xsltGetLoaderFunc(void) {
|
|||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
|
|
||||||
py_retval = pythonDocLoaderObject;
|
py_retval = pythonDocLoaderObject;
|
||||||
return(py_retval);
|
return(py_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ libxslt_xsltNewTransformContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
|
|
||||||
style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style);
|
style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style);
|
||||||
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
|
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
|
||||||
|
|
||||||
c_retval = xsltNewTransformContext(style, doc);
|
c_retval = xsltNewTransformContext(style, doc);
|
||||||
py_retval = libxslt_xsltTransformContextPtrWrap((xsltTransformContextPtr) c_retval);
|
py_retval = libxslt_xsltTransformContextPtrWrap((xsltTransformContextPtr) c_retval);
|
||||||
return (py_retval);
|
return (py_retval);
|
||||||
@ -645,13 +645,13 @@ libxslt_xsltFreeTransformContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args
|
|||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:xsltFreeTransformContext", &py_tctxt))
|
if (!PyArg_ParseTuple(args, (char *) "O:xsltFreeTransformContext", &py_tctxt))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
tctxt = (xsltTransformContextPtr) PytransformCtxt_Get(py_tctxt);
|
tctxt = (xsltTransformContextPtr) PytransformCtxt_Get(py_tctxt);
|
||||||
xsltFreeTransformContext(tctxt);
|
xsltFreeTransformContext(tctxt);
|
||||||
|
|
||||||
/* Return None */
|
/* Return None */
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return(Py_None);
|
return(Py_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
@ -808,7 +808,7 @@ libxslt_xsltApplyStylesheet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||||
PyObject *py_retval; /* our final return value, a python string */
|
PyObject *py_retval; /* our final return value, a python string */
|
||||||
xmlChar *buffer;
|
xmlChar *buffer;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int emitted = 0;
|
int emitted = 0;
|
||||||
@ -822,14 +822,14 @@ libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
result = (xmlDocPtr) PyxmlNode_Get(pyobj_result);
|
result = (xmlDocPtr) PyxmlNode_Get(pyobj_result);
|
||||||
style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style);
|
style = (xsltStylesheetPtr) Pystylesheet_Get(pyobj_style);
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: We should probably add more restrictive error checking
|
/* FIXME: We should probably add more restrictive error checking
|
||||||
* and raise an error instead of "just" returning NULL.
|
* and raise an error instead of "just" returning NULL.
|
||||||
* FIXME: Documentation and code for xsltSaveResultToString diff
|
* FIXME: Documentation and code for xsltSaveResultToString diff
|
||||||
* -> emmitted will never be positive non-null.
|
* -> emmitted will never be positive non-null.
|
||||||
*/
|
*/
|
||||||
emitted = xsltSaveResultToString(&buffer, &size, result, style);
|
emitted = xsltSaveResultToString(&buffer, &size, result, style);
|
||||||
if(!buffer || emitted < 0)
|
if(!buffer || emitted < 0)
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
/* We haven't tested the aberrant case of a transformation that
|
/* We haven't tested the aberrant case of a transformation that
|
||||||
* renders to an empty string. For now we try to play it safe.
|
* renders to an empty string. For now we try to play it safe.
|
||||||
@ -837,7 +837,7 @@ libxslt_xsltSaveResultToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
if(size)
|
if(size)
|
||||||
{
|
{
|
||||||
buffer[size] = '\0';
|
buffer[size] = '\0';
|
||||||
py_retval = PyString_FromString((char *) buffer);
|
py_retval = PyString_FromString((char *) buffer);
|
||||||
xmlFree(buffer);
|
xmlFree(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1125,7 +1125,7 @@ libxslt_xsltRegisterExtensionClass(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
Py_XINCREF(pyobj_c);
|
Py_XINCREF(pyobj_c);
|
||||||
|
|
||||||
ret = xsltRegisterExtModuleFull(ns_uri,
|
ret = xsltRegisterExtModuleFull(ns_uri,
|
||||||
(xsltExtInitFunction) libxslt_xsltPythonExtModuleCtxtInit,
|
(xsltExtInitFunction) libxslt_xsltPythonExtModuleCtxtInit,
|
||||||
(xsltExtShutdownFunction) libxslt_xsltPythonExtModuleCtxtShutdown,
|
(xsltExtShutdownFunction) libxslt_xsltPythonExtModuleCtxtShutdown,
|
||||||
(xsltStyleExtInitFunction) libxslt_xsltPythonExtModuleStyleInit,
|
(xsltStyleExtInitFunction) libxslt_xsltPythonExtModuleStyleInit,
|
||||||
|
@ -403,7 +403,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
|
|||||||
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
|
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
|
||||||
node = obj->nodesetval->nodeTab[i];
|
node = obj->nodesetval->nodeTab[i];
|
||||||
if (node->type == XML_NAMESPACE_DECL) {
|
if (node->type == XML_NAMESPACE_DECL) {
|
||||||
PyObject *ns =
|
PyObject *ns =
|
||||||
PyCObject_FromVoidPtrAndDesc((void *) node,
|
PyCObject_FromVoidPtrAndDesc((void *) node,
|
||||||
(char *) "xmlNsPtr",
|
(char *) "xmlNsPtr",
|
||||||
libxml_xmlXPathDestructNsNode);
|
libxml_xmlXPathDestructNsNode);
|
||||||
|
Reference in New Issue
Block a user