Dynamator Pure HTML for every page generation technology.
           

Dynamator File for ASP


Contents

Description
Identification

DESCRIPTION

This document describes the language-specific format and code generation behavior of a Dynamator File coded to create a Microsoft Active Server Pages file.

ASP supports multiple scripting languages. The following Dynamator File root elements indicate that an ASP file should be generated:

<dynamator language="asp">
Generate an ASP file for VBScript.
<dynamator language="asp.vb">
Generate an ASP file for VBScript.

VBScript is the default language, and the only language currently supported by Dynamator. Future languages will be indicated by new extensions; for example, if JScript were to be supported, the Dynamator language might be "asp.js".

A Dynamator File specifying language "asp" or "asp.vb" identifies a file containing transformations to be applied to an HTML or XML template in order to produce an ASP source file (i.e. a file with filetype ".asp"). Dynamator applies the Dynamator file to an HTML or XML file (the "template") to create an ASP that outputs an HTML or XML file with structure corresponding to the template and behavior specified by the Dynamator file.

Because the VBScript engine expects files containing scripts to be in DOS format, Dynamator ensures that lines are terminated with CRLF, even if lines in Dynamator's input files are not.

ASP Elements

Where a Dynamator File allows program lines, any ASP scripting element may be used. (ASP scripting elements are declarations (<%@ ... %>), scriptlets (<% ... %>) and expressions (<%= ... %>).)

for

The 'for' element of a Dynamator file for ASP has the following structure:

<for>
    for-statement-remainder
</for>

The content of the 'for' element is the remainder of the 'For' statement. The text is treated as CDATA; that is, it may contain special characters such as '<'.

For example, the element:

<for>i = 0 To 100 Step 2</for>
generates:
For i = 0 To 100 Step 2
    ...
Next

foreach (collections)

The collection form of a 'foreach' element in a Dynamator ASP file has the following structure:

<foreach 
      element="element-variable-name"
    >
    <!-- Content: collection-or-array-name -->
</foreach>

The content of the foreach element must be the name of a collection or array.

The 'foreach' element must have the following attribute:

element="vb-variable-name"
(Required)
Identifies the name of the variable that refers to the current element of the collection.

The collection form of the 'foreach' element maps to the following VBScript statement pattern:

For Each element In collection
...
Next

foreach (sequenced)

The sequenced form of the 'foreach' element has been deprecated. Use the for element instead.

The sequenced form of a 'foreach' element in a Dynamator ASP file has the following structure:

<foreach 
      i="iteration-variable-name"
      first="initial-value-expression"
      last="final-value-expression"
      { step="increment-value-expression" }
/>

It maps to the following VBScript statement pattern:

    For i = first To last { Step step }
    ...
    Next

The sequenced values form of the 'foreach' element takes no element content. It takes the following attributes:

i="iteration-variable-name"
(Used only if supported by the target language's generator.)
The name of the iteration variable. The value of the iteration variable changes with each iteration. It is initialized to 'first' and incremented by the value of 'step'.

first="initialize"
(Required)
The value of i for the first iteration of the loop.

last="compare"
(Required)
The value of i for the last iteration of the loop.

step="increment"
(Required)
The amount i is changed between each iteration. If not supplied, the 'step' part of the statement is omitted.


SEE ALSO

dynamate, Dynamator File


IDENTIFICATION
Author: Jay Dunning
Version: 1.5
Copyright: 2000-2004, Jay Dunning