cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject CGI::XMLForm
Date Fri, 21 Jan 2000 04:03:33 GMT
Hey guys -

I was recently working with XML/XSLT for a project for which I was unable
to use cocoon and had to explore some of the other tools out there. The
app was pretty simple - take in an HTML form whose fields describe what a
fairly complicated HTML page should look like and generate said page XSLT
sounded perfect to generate the final output, but I needed a way to take
the form data and turn it into some nice looking XML. Sure, I though, I
could use XSP and reference fields like this:

<request:get-variable name="foo"/>

(or something like that, anyway) but then all of my variables exist in a
flat namespace, and the stylesheet I was writing to turn that into the
HTML page was getting really scary. I realized that what I wanted was
something that let me describe where the HTML form fields belonged in an
structured XML document and would generate it for me. I found what I was
looking for, more or less, in a perl module (god forbid that anything
useful be found there :)). CGI::XMLform let me transform HTML forms that
look something like this:

<form>
 <input type="text" name="/page/header/title">
 <input type="text" name="subtitle">
 <input type="text" name="../body">
</form>

into xml that looks something like this:

<page>
 <header>
  <title>...</title>
  <subtitle>...</title>
 </header>
 <body>...</body>
</page>

in essence, you name the html form elements according to an XPath-like
syntax and the perl module builds the XML document for you. It's not a
perfect tool (I even found a bug or two) but it sure got the job done.

Anyway, if you're into that kind of thing at all, I recommend checking it
out from your nearest CPAN archive. The reason I bring it up here is to
see if anyone would be interested in working on something similar for
cocoon?

- donald


Mime
View raw message