Re: [xsl] HTML to XML via XSL ?

Subject: Re: [xsl] HTML to XML via XSL ?
From: Gregory Murphy <Gregory.Murphy@xxxxxxxxxxx>
Date: Thu, 10 Oct 2002 11:56:43 -0700 (PDT)
On Wed, 9 Oct 2002, Mac Martine wrote:

> Hello-
>  I am generating HTML from XML via XSL. The original XML file is not
> predictable in content, but my XSL is still smart enough to convert xml
> nodes with certain names to specific html form objects. Great, so far.
> 
> So, now I want the users' form selections to be written back as xml when
> the html form is submitted. Is there a way to do this? So, basically, I
> would need to go through all HTML form objects in that page, and write
> them as xml nodes along with their selected/user defined values.
> Make sense?
> 
> Thanks a lot-
> Mac

Since HTML is an SGML doctype (and not an XML doctype), what you want to do
is convert the documents from SGML to XML. 

If the documents are large and complicated, you might want to use a tool
like James Clark's sx to do the conversion. It is part of the sp toolkit:
http://jclark.com/sp. You'll need the correct HTML DTD. You can get that
from the W3C, http://w3.org/MarkUp.

If the documents are small, already well structured, and the tag usage
limited and predictable, you might prefer using a scripting language like
Perl to make the necessary changes, such as rewriting empty elements in
their XML format, replacing ISO character entity references, adding implied
attribute values, and so on.

Good luck!

// Gregory Murphy <Gregory.Murphy@xxxxxxx>
// Software Engineer
// Customer Network Platform, Sun Microsystems



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


Current Thread