How to change or reassign a variable in XSLT?

Variables in XSLT may only be assigned a value once. This is done by design. See Why Functional languages? for an appreciation of the motivation in general.

Rather than reassign a variable, write conditionals against the input document directly, or call a function (or named template) recursively with varying local parameters.

Anything you need to do can be done with an approach that does not require reassignment of variables. To receive a more specific answer, provide a more specific question.

See also:

Leave a Comment