Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jsmith (3335)

jsmith
  (email not shown publicly)
http://www.jamesgottlieb.com/
Jabber: jgsmith@tamu.edu

I'm a web applications developer trying to bring all things open source to all things humanities at Texas A&M University.

Journal of jsmith (3335)

Thursday November 13, 2003
01:03 AM

Transforming programs and XSM

[ #15743 ]

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:

<statemachine>
   <wiz:steps>
     <wiz:step>
       <variable id="filename"/>
       <variable id="title"/>
       <variable id="description"/>
     </wiz:step>
     <wiz:step>
       <variable id="states"/>
     </wiz:step>
     <wiz:step>
       <variable id="state.initial"/>
       <variable id="state.transitions"/>
     </wiz:step>
   </wiz:steps>
</statemachine>

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.

<grid id="things" count="multiple">
   <column id="foo"/>
   <column id="bar"/>
   <row id="red"/>
   <row id="black"/>
</grid>

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.