Processing Instructions

The Processing Instructions component allow those familiar with scripting to embed script code directly in the markup of documents. This is useful to be able to rapidly prototype dynamic pages. For example, with a few lines of code you can embed a value in your pages that are created as a result of a form submitted to the page.

The inline script can be written using the more than 2000 well-defined functions that are built into Interaction. This is far more than is available in any of the current server side scripting environments (e.g. WebSiphon or Frontier). Importantly, the language supported by Interaction is ANSI standard, so you don't have to take to invest your time in a proprietary language with limited support and unsecure future.

In addition to the powerful capabilities of dynamic object-oriented Common LISP, you can also embed commands in AppleScript or other OSA languages such as frontier by also installing the AppleScript Tools component.

Installing the Processing Instructions Component

  1. Download the Processing Instructions archive.
  2. Unstuff the archive (most browsers will do this for you).
  3. Find the appropriate version of the component in the folder that best matches your version of Interaction.
  4. Put the component file in the Components folder of Interaction
  5. Restart Interaction to activate the component.

What are Processing Instructions?

A processing instruction is a feature from the SGML standard on which HTML is founded. It allows you to embed a system-dependent formatting instruction in markup. According to the standard, a processing instruction starts with '<?' and ends with '>', with code in between.

Processing instructions has the ability to affect the processing of a document. Whatever is written to output by the script will be embedded in the page in the place of the processing instruction. For example, this processing instruction will embed the string "Hello Web!" in the resulting page:

<? write-string "Hello Web!" >

This will send an email with the content of a field with name "address" submitted to the location:

<?
(mailto "myname@company.com"
  :subject "Here is a submission"
  (argument-value "address"))
>

Processing Instructions also provide an ad-hoc way to make Interaction perform certain actions at the time the document is formatted. Any code in the processing instruction will be executed at the time that particular part of the document is formatted. For example, adding this processing instruction to an HTML document will make Interaction create a beep whenever the location is visited:

<? beep >

These are just very simple examples. Interaction provide not only powerful general libraries, but also specialized functions particularly useful for web applications.

Disadvantages of Mixing Instructions with Markup

Decades of experience with automatic document processing has revealed that it is usually a bad idea to mix instructions with markup. Despite this, most document processing applications for the web (included NetCloak and others on the Mac) has repeated over again the old mistake of adding commands to the markup, often revealing lack of knowledge and philosophy on what markup is about and in effect setting the web developers a decade back in time. Commands provide a quick way to achieve certain effects, but has the disadvantage of severely limiting more advanced processing of the information.

Mixing instructions with markup has its use in rapid prototyping of dynamic locations. By mixing code in the markup you can quickly test out new ideas. The Processing Instructions feature of Interaction provide a way to do this that follows the International Standard for Markup. However, for more permanent solutions you are advised to use the Entity feature of Interaction as a more flexible alternative, so that your code is not mixed with markup. Entities facilitates long-term management of your content. The Function Entity Type provides a means of making entities based on script code, and many others are available that doesn't require any scripting at all.


This site is enhanced with Interaction.