@@ -1259,13 +1259,6 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
1259
1259
return (result );
1260
1260
}
1261
1261
1262
- static void
1263
- xsltEvalGlobalVariableWrapper (void * payload , void * data ,
1264
- const xmlChar * name ATTRIBUTE_UNUSED ) {
1265
- xsltEvalGlobalVariable ((xsltStackElemPtr ) payload ,
1266
- (xsltTransformContextPtr ) data );
1267
- }
1268
-
1269
1262
/**
1270
1263
* xsltEvalGlobalVariables:
1271
1264
* @ctxt: the XSLT transformation context
@@ -1278,6 +1271,7 @@ xsltEvalGlobalVariableWrapper(void *payload, void *data,
1278
1271
int
1279
1272
xsltEvalGlobalVariables (xsltTransformContextPtr ctxt ) {
1280
1273
xsltStackElemPtr elem ;
1274
+ xsltStackElemPtr head = NULL ;
1281
1275
xsltStylesheetPtr style ;
1282
1276
1283
1277
if ((ctxt == NULL ) || (ctxt -> document == NULL ))
@@ -1321,6 +1315,8 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
1321
1315
xsltFreeStackElem (def );
1322
1316
return (-1 );
1323
1317
}
1318
+ def -> next = head ;
1319
+ head = def ;
1324
1320
} else if ((elem -> comp != NULL ) &&
1325
1321
(elem -> comp -> type == XSLT_FUNC_VARIABLE )) {
1326
1322
/*
@@ -1343,9 +1339,19 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
1343
1339
}
1344
1340
1345
1341
/*
1346
- * This part does the actual evaluation
1342
+ * This part does the actual evaluation. Note that scanning the hash
1343
+ * table would result in a non-deterministic order, leading to
1344
+ * non-deterministic generated IDs.
1347
1345
*/
1348
- xmlHashScan (ctxt -> globalVars , xsltEvalGlobalVariableWrapper , ctxt );
1346
+ elem = head ;
1347
+ while (elem != NULL ) {
1348
+ xsltStackElemPtr next ;
1349
+
1350
+ xsltEvalGlobalVariable (elem , ctxt );
1351
+ next = elem -> next ;
1352
+ elem -> next = NULL ;
1353
+ elem = next ;
1354
+ }
1349
1355
1350
1356
return (0 );
1351
1357
}
0 commit comments