Advanced VSPX programming
VX-S-8 VSPX macros
Using macro expansion
Example
In the first example of this section VX-S-1 we mentioned that except vspx:include there is more powerful feature for macro expansion. This feature is explained here. The idea is to have two more source files named style and decoration. They are assigned to the target page via vspx:page attributes "decor" and "style" respectively.
The way these are working is the following: before any compilation phase the decor file will be expanded with page itself (see placeholder element). After that the style will be applied and result will be saved in an intermediary file named as original with .vspx-m. As a last step of process would be the page compilation of the intermediary file. This step will generate also a SQL script for page class and it's member functions definitions. The last step of page compilation is execution of the .vspx-sql script and hence creation of objects into the server memory.
The example extends the formsty.vspx page with expansion of formdecor.vspx file and make rendition before compilation with formsty.xsl. In that way we can make similar pages with very simple structure, which are with same style and appearance. Also we can divide VSPX page design from functionality.
| View the source | Action |
|---|---|
| 1. formdecor.vspx | |
| 2. formsty.vspx | Run |
| 3. formsty.xsl |
OpenLink Home
Technical Support