Subweb Home
PLASMA Home
Overview
Template Syntax
Command Line
Template Tutorial
Worked Example
Code Style Guide
Schema Definition
Error Messages
Problem Reports
PARSEC Licence
A Tutorial Guide to Writing PARSEC
Introduction

This tutorial assumes you have downloaded the PLASMA*PARSEC Website worked example and can run PARSEC scripts.

PARSEC Design Patterns

It is frequently necessary to list out a number of items on the same line separated by commas and write a default text out if the list is empty. A much used construct to achieve this is shown below:

    |
    <<<Template=MOT_Person>>>
        |
        <<<:>>>
        |
        <<<Template=MOT_Car>>>
            |
            <<<#MOT_Car.Model>>>
            |
            <<<[>>>
                |
                ,
                |
            <<</[>>>
            |
            <<<~>>>
                |
                void
                |
            <<</~>>>
            |
        <<<Endplate=MOT_Car>>
        |
    <<<Endplate=MOT_Person>>>
    |
    <<<:>>>
    |

This fragment assumes each Car is owned by one Person and that each Person can own any number of Cars including zero.

The construct is designed to list out the Model names of all Cars onwed by each Person. A comma will be copied to the output stream after each Model name except after the last one. The list for each Person will start on a new line. If no Cars are associated with a Person (Person does not own a Car), the word "void", on its own line, will be copied over instead.

MON-10-NOV-2003