Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preserver line breaks...

Status
Not open for further replies.

mitchelt

Technical User
Jul 30, 2001
21
0
0
US
I have read a ton about this and still can't get it to work.

In the XML doc I want to display the "title" in multiple lines.

Any help would be greatly appreciated.

Code below.

Thanks...Mitch
************************************

XML DOC
---------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="books_style.xsl"?>

<books>
<book>
<author>Peter Pan</author>
<title xml:space="preserve">
Book Title 1 Line 1

Book Title 1 Line 2
</title>
</book>
<book>
<author>Jane Doe</author>
<title xml:space="preserve">Book Title Line</title>
</book>
</books>



XSL DOC
---------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="<xsl:eek:utput method="html"/>
<xsl:template match="/">
<html>
<body>
<h2>Books List</h2>
<table border="1">
<tr bgcolor="#eeeeee">
<th align="left">Author</th>
<th align="left">Book Title</th>
</tr>
<xsl:for-each select="books/book">
<tr>
<td>
<xsl:value-of select="author"/>
</td>
<td>
<xsl:value-of select="title"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>

</xsl:template>
</xsl:stylesheet>
 
perhaps try pre tags in your xsl?

Code:
<pre>
<xsl:value-of select="title"/>
</pre>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top