You have to be inside a template to access the DOM structure of the XML...
The only thing placing variables outside the template is good for is to define constants (values that do not change)
Say you will be using PI, you could define it at the top as:
<xml:variable name="pi" select="3.14159265" />
in which case, you could then use $pi instead of typing out 3.14159265 every time in the rest of the XSL...
plus, if you made a typo, you fix it in one place, instead of having to change every instance...
It would be useless to use <xsl:if> outside the template, due to the fact that since you would be dealing with constants, the results would always be the same, which would in turn eliminate the need for them.
On the other hand, you can make multiple templates, so you could use one for your <xsl:if> statements, then branch off to different areas from there...
In other words, include the XSL code, from the 2 files you refer to, as Named templates, then use <xsl:if> to call them...
Here is some more info on this:
Hope this helps,
-Josh
Visit My Site
PROGRAMMER:
Red-eyed, mumbling mammal capable of conversing with inanimate objects.