[xsl] generating human-readable HTML

Subject: [xsl] generating human-readable HTML
From: Kevin Rodgers <kevin.rodgers@xxxxxxx>
Date: Tue, 1 Mar 2005 16:33:47 -0700
I know this is a softball for the experienced XSLT'ers, but I haven't
found the answer in the archives or the FAQ.  Basically I want to
preserve new lines that are present in my HTML literal result elements.
For example, here's an excerpt from my stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xhtml"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

<xsl:template match="report">
  <xsl:variable name="title" select="concat(header, ' ', issue)"/>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title><xsl:value-of select="concat($title, ' Report')"/></title>
</head>
<body>
...
</body>
</html>
</xsl:template>

which generates the following (the ellipsis above contains an
xsl:apply-templates instruction and the ellipsis below is the resulting
table, which is fairly long and what I really want to be readable):

<html xmlns="http://www.w3.org/1999/xhtml";><head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <title>INDUSTRY STANDARDS 20050301 Report</title></head><body>...</body></html>

I've tried adding a xml:space="preserve" attribute to the
xsl:stylesheet, xsl:template, and html elements, but to no avail: I
always get one long line of output.  Is this one of those things one is
just not supposed to do?

-- 
Kevin Rodgers

Current Thread