RE: [xsl] Generating beautiful HTML Source Code

Subject: RE: [xsl] Generating beautiful HTML Source Code
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Wed, 15 Oct 2003 11:15:26 -0600
> From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxx]
> Sent: Wednesday, October 15, 2003 8:56 AM
> Subject: [xsl] Generating beautiful HTML Source Code
> 
> 
> Hello,
> 
> I'd be interested in any reference (websites - faq...) you 
> might be able to
> point me to regarding Whitespace.  Call me anal, but I'm very 
> interested in
> generating very attractive HTML source code results, you know 
> - line breaks,
> tabs, comments, etc...

Generating pretty-printed HTML can be difficult, if not impossible, with
most processors.  You can try using the following output element:

<xsl:output method="html" indent="yes"/>

but implementations are not required to honor the indent attribute, and
there's no definition of that output in the spec.  The best method would be
to run the HTML output through Tidy or another pretty-print utility after
transformation.

If you want comments to show up in your *output*, you need to use
<xsl:comment/>, which will cause the contents of the element to appear in
the result document within HTML comment tags (<!-- -->).  Since these also
represent comment nodes in XML, using them directly in your stylesheet
causes the processor to strip them out during compilation.

hth,
b.

| brian martinez                           brian.martinez@xxxxxxxxxxx |
| lead gui programmer                                    303.357.3548 |
| cheap tickets, part of trip network                fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400           englewood, co 80111 |
| cendant travel distribution services   http://www.cheaptickets.com/ |

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


Current Thread