Transforming programs and XSM

jsmith on 2003-11-13T06:03:30

I've been working some more on my eXtensible State Machines --- web applications written using an XML language. Some interesting things are coming out of this. (And I hope to have something released around the end of the month if I can get certain testing done.)

First, there are continuations. I don't have those implemented yet, but I have about half-continuations done. That is, you can suspend the current program and run another, sending views to the client browser and processing the input. Then, when that program is finished, you can drop back to the prior program in the state you left it. You don't yet get dropped back into the code where you called out to the other program and you can't pass data back to the calling program. That would be full continuations.

Second, I borrowed an idea from AxKit/XSP (see ``Taglib TMTOWTDI'') and now support applying XSLTs to the programs written in XML. Makes sense. XSLT is designed to transform XML documents. Now, instead of running program P, I can run a transform of it: f(P), f: XML -> XML. I like the mathematical notions.

This is useful because some (many?) of the little applications we are needing to write consist of a series of pages collecting information and then a final step doing something with that information. If we wanted to support `Prev', `Next', etc., functionality to make a wizard-like flow, we had to code transitions for each one in each state. Now, I can write something like:

 
   
     
       
       
       
     
     
       
     
     
       
       
     
   
 

You can get the idea. Applying an appropriate XSLT ensures that I can go back and forth through the pages with proper validation and storage of the data without having to duplicate a lot of code by hand. So now, I have XML -> f(XML) -> Perl(f(XML)) -> byte-code(Perl(f(XML))) -> ....

Third thing (second that I did today) is making a form element.

 
   
   
   
   
 

This produces a 2x2 grid of checkboxes allowing the selection of the values red.foo, red.bar, black.foo, and black.bar. Different values of @count affect whether its a checkbox or radio button, and whether it is constrained by row, by column, or not at all. Now I just need to get the XSM content provider to be able to manage the default values automatically.