Re: [xsl] XML -> HTML beautifier...

Subject: Re: [xsl] XML -> HTML beautifier...
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 23 Oct 2001 15:07:11 -0600 (MDT)
Oleg Tkachenko wrote:
> Dr. Kaos wrote:
> 
> > I was just wondering if there is XSLT (or any tool) that would transform
> > an XML file to an HTML file that following features:
> > 
> > (1) color coded
> > (2) indented
> > (3) long lines wrapped
> > 
> > More like IE or Mozilla view of an XML file.
> 
> Why not use the same default stylesheet IE apply to xml files?
> See xslt version in faq: 
> http://www.dpawson.co.uk/xsl/sect2/microsoft.html#d156e206

The problem with this is that it is an HTML (DHTML+CSS) result of an XSLT
transformation, which means the XML has been parsed first, and thus you do
not see the document's original representation. So if you want to see the
XML declaration, character and entity references, the DTD, and whitespace
that has not been collapsed into a word separator (a single space,
typically), then you're out of luck.

To get a pretty HTML representation of the original, unparsed XML, you'll
need to use a tool that treats it as raw text. This would be a fun
exercise for a language like Perl or Python, an ordeal in Java, and
impossible in XSLT without an extension function to read a file without
parsing it. I personally don't know of any such utilities, but I haven't 
looked too hard either.

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

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


Current Thread