Re: Scope of variables
When I first was shown programming (Fortran at school in the mid 70's) this aspect of fortran allowing variables to change their definition was the main "strange" thing about programming languages that all the books stressed. that programming languages had these strange imperative features because they were designed to be easily executed by machines rather than easily understood by humans.
As a footnote to what David says, as a "human-oriented declarative language" XSLT seems to work best (partly; and I say "seem" because (a) this is actually a bit complicated, and (b) I just use these machines I don't build them) when you let it *manage for you* the processing logic of the operation (by letting it execute, where possible, a tree traversal). These are "templates", not "subroutines", and variables are mainly used to hold values that you may want and need, not control the process flow. Not long ago on this list I suggested an XSLT transform needs to be seen as an *output specification*, not a process. (At which someone helpfully mentioned the functional view: you are designing a function in terms of outputs for given inputs, and shouldn't have to worry about how the machine goes about executing it.)
It takes a real shift in mind set, especially when you run into problems for which XSLT *doesn't* give you direct support, and you find yourself implementing loops by recursion, etc. Not that that can't be done -- it can, and has been.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format