📎 Webclip
XSLT ForEach
The stylesheet matches the document root, switches output to text, and starts a named template with start and end parameters. The template checks whether the start is within the end, prints the number when both are equal, and otherwise splits the range at the midpoint and calls itself twice.
Reading notes#
- The root template calls
displayNumberswithpStartset to 1 andpEndset to 1000000. displayNumberstakes two parameters,pStartandpEnd.- When
pStartis not greater thanpEnd, the template continues. - If
pStartequalspEnd, it outputs the current number followed by a line break. - Otherwise, it computes
vMidasfloor(($pStart + $pEnd) div 2). - It then calls
displayNumbersfor the left half frompStarttovMid. - It calls
displayNumbersagain for the right half fromvMid+1topEnd.
