Define the term scope, and describe the role of scope in the creation of XSLT style sheets, including an explanation the implication of a variable's possible scope.

What will be an ideal response?


The locations in the style sheet where a variable can be referenced are known as the variable's scope. The scope is determined by where the variable is defined. In general, a variable can only be referenced within the element in which it is defined. Variables are said to have either global or local scope.?A variable with global scope, also known as a global variable, can be referenced from anywhere within a style sheet. To create a global variable, the tag must be at the top level of the style sheet, as a direct child of thestylesheet element. Because global variables are referenced anywhere in a style sheet, each global variable must have a unique variable name to avoid conflicts with variable names defined with the same name elsewhere in the style sheet. The advantage of a global variable is that it can be referenced within any template in the style sheet.
A variable that is created within an element, such as a template, is known as a local variable, has local scope, and can be referenced only within that element or template. Unlike global variables, local variables can share the same variable name if they are declared in different elements or templates. You can also assign the same name to a global variable and a local variable. In this case, an XSLT processor uses the local variable within the element in which it is defined and the global variable anyplace else it is referenced. Even though the same variable name can be used in the situation just described, it is best practice to give each variable a unique name, regardless of whether it is a global or a local variable, in order to avoid confusion.??

Computer Science & Information Technology

You might also like to view...

The ________ enables you to change the magnification of the document or worksheet

Fill in the blank(s) with correct word

Computer Science & Information Technology

A ____ is a space-saving pointing device embedded in the keyboard of a notebook computer that you can push up, down, or sideways.

A. TrackPoint B. trackpad C. touchpad D. trackball

Computer Science & Information Technology

A(n) ________ is reserved area for text or graphics that displays at the bottom of each page of a document

Fill in the blank(s) with correct word

Computer Science & Information Technology

When you ________ a selection, the selection is removed from the original location and is placed in the Clipboard

Fill in the blank(s) with correct word

Computer Science & Information Technology