Nassi-Shneiderman Diagrams

Axel T. Schreiner
rev. 07-13-05

This is a CSS1 stylesheet and a XSLT script to convert a XML-based representation of a Nassi-Shneiderman diagram described by a DTD to HTML.

<nsd> action ... </nsd>
A diagram node contains one or more action nodes.
<action> markup... </action>
<nsd>
  <action> <b> a </b> </action>
  <action> <i> b </i> </action>
</nsd> 
a
b
A simple action node contains character data and XHTML markup.
<seq> action ... </seq>
A sequence node contains one or more action nodes and is itself an action node.
<if>
  <condition> markup... </condition>
  <case> markup... </case> action
  ...
</if>
<nsd>
  <if>
    <condition> <i> cond </i> </condition>
    <case> true </case>
    <action> then <br/> part </action>
    <case> false </case>
    <action> else-part </action>
  </if>
</nsd> 
cond
true false
then
part
else-part
A decision node is an action node. It contains a condition node and then two or more case nodes, each followed by a single action node. Condition and case nodes contain character data and XHTML markup.
<switch>
  <condition> markup... </condition>
  <case> markup... </case> action
  ...
</switch>
<nsd>
  <switch>
    <condition> <i> cond </i> </condition>
    <case> true </case>
    <action> then <br/> part </action>
    <case> ... </case>
    <action> other part </action>
    <case> false </case>
    <action> else-part </action>
  </switch>
</nsd> 
cond
true
then
part
...
other part
false
else-part
This version of a decision node is represented in a format that is more suitable to many alternatives.
<loop>
  <condition> markup... </condition>
  action
  <condition> markup... </condition>
</loop>
<nsd>
  <loop>
    <condition> <i> cond </i> </condition>
    <action> body </action>
  </loop>
</nsd> 
cond
body
A loop node is an action node. It contains a condition node and a single action node. A condition node contains character data and XHTML markup.
<nsd>
  <loop>
    <action> body </action>
    <condition> <i> cond </i> </condition>
  </loop>
</nsd> 
body
cond
The condition node can follow the action node.
<nsd>
  <loop>
    <condition> <i> before </i> </condition>
    <action> body </action>
    <condition> <i> after </i> </condition>
  </loop>
</nsd> 
before
body
after
There can be two condition nodes.