%load keyword (SDL script)
This keyword loads another generation template for processing. After the loaded template has been processed, control returns to the point in the calling template immediately after the %load statement.
The called template can be preceded by a relative path, that is, a path relative to the folder in which the generation template making the call resides. When specifying a relative path, you must use the '\\' escape code to specify a backslash. For example:
%load "..\\..\\HasStereotype.sdl"
The path in which the Generate.sdl template resides is recorded through the sysSchemeDirectory system variable.
Parameters can be passed to the called generation template through the %param keyword. The %param keyword can pass a local variable to the called generation template. The called generation template can get the value of the passed parameter through the %getparam keyword and set the value of the passed parameter through the %setparam keyword.
Syntax
%load "<template relative path and file name>" [%param "<parameter 1>" %param "<parameter 2>" etc.]
The following examples are provided:
%load with no parameters
%load with parameters
Example 7. %load with no parameters
In this example, the PackageName.sdl template is loaded and processed.
%load "PackageName.sdl"
Example 7. %load with parameters
In this example, the GetRelativePathDots.sdl generation template is loaded and processed. The GetRelativePathDots.sdl is passed the strDots local variable as a parameter.
%localstring "strDots"
%setlocalvar "strDots" = ("..") & (%getvar "sysPathSeparator")
%load "GetRelativePathDots.sdl" %param "strDots"