[xslt] Strange interaction between <xsl:text> and whitespace in XML outputmode
- From: Nick Wellnhofer <wellnhofer aevum de>
- To: xslt gnome org
- Subject: [xslt] Strange interaction between <xsl:text> and whitespace in XML outputmode
- Date: Wed, 22 Oct 2003 18:53:26 +0200
Given the following stylesheet
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="iso-8859-1" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<xsl:text> </xsl:text>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
and a dummy XML document with an empty root node, I get the following result
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Test</title>
</head>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr> <td>4</td><td>5</td><td>6</td></tr>
</table>
</body>
</html>
The <xsl:text> inside the second <tr> seems to disable the indented
formatting. Apparently all whitespace is stripped inside elements that
contain <xsl:text>.
This only happens in XML output mode. In HTML output mode (just use a
<html>-element without attributes and adjust the doctype) the result is:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test</title>
</head>
<body><table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr> <td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table></body>
</html>
Is this the expected behaviour? If yes, almost all elements in an XHTML
result document will appear on one line which is still correct but
completely unreadable.
I'm not on the list, please CC me.
Nick Wellnhofer
--
aevum gmbh
leopoldstr. 87
80802 münchen
germany
fon: +4989 38380653
fax: +4989 38799384
wellnhofer@aevum.de
http://aevum.de/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]