RFC on ways to do XML => HTML on the fly from Perl

Subject: RFC on ways to do XML => HTML on the fly from Perl
From: Andrew Bunner <bunner@xxxxxxxxxxxxxxxxxx>
Date: Mon, 04 Jan 1999 16:23:23 -0800
  I didn't mean to rhyme, honest...

  Our company has a bunch of frequently asked question/answer pairs that
contain mark-up (links, hiliting, etc.) Right now, our FAQ document looks
like this...

<question>How do I spell my name?</question>
<answer>
<paragraph>It depends on a variety of factors. See our <A
HREF="http://somewhere.com/document.html";>guide</A> to name spelling
</paragraph>
</answer>

  ...Currently, I use the new XT and an XSL stylesheet to transform the FAQ
into some nicely formatted HTML. When I want to include a question-answer
pair in an one of my XML documents, I just copy and paste it from my
"master" FAQ document.

  The problem is that I hate to duplicate data that may potentially become
stale.

  My tools are Oracle, Perl, XT and anything else I can download for free.
I want to make it so that each page that wants to include some
question-answer pairs can request only those pairs that are relevant for
that page. In the end, I'm interested in the HTML formated output--that's
what the user will see.

  I've come up with a few different strategies, but I wanted to see if I
could get input from more experienced minds. There may be tools/pitfalls
that I don't know about.

Strategy #1

Make a separate XML file for each Q&A document (one question-answer pair
per document). Run each of these files through XT to get HTML files. Use a
database table to relate each of these HTML files to the web
pages/auto-responders that want to include the HTML for that Q&A document.

When a page gets loaded, run some embedded perl that...
1) queries the database to find the HTML files that need including
2) reads them
3) spits the content of these Q&A documents into the final web page the
user sees

Strategy #2

Include the actual XML of each Q&A document in the database. Have a table
that relates the Q&A XML blocks to the web pages that care about them.

When a page gets loaded, run some embedded perl that...
1) queries the database to get the "right" blocks of XML
2) write these XML blocks to temporary files
3) run each of the temporary files through XT to get HTML
4) read the result files and include them in the final document that the
user sees

Strategy #3

Somehow use XML::XQL ... this seems vaguely applicable but I'm not sure if
it fits the bill as well as the SQL-Oracle combination.

  Does anyone have any comments or additional strategies to suggest? Has
some praise-worthy soul written an XSL process in Perl? Am I a fool for
even atttempting this?

  This is cross-posted to xsl-list@xxxxxxxxxxxxxxxx and
perl-xml@xxxxxxxxxxxxxxxxxxxxxxxx

-- Andrew

   Andrew Bunner
   President, Mass Quantities, Inc.
   bunner@xxxxxxxxxxxxxxxxxx
   Professional Supplements for the Perfect Physique
   http://www.massquantities.com 
   


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread