[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Translating the new lines to line breaks with HTML tr

Subject: Translating the new lines to line breaks with HTML transformation
From: "Soyer, Muhammed A." <MSoyer@xxxxxxxxxx>
Date: Fri, 9 Dec 2011 15:02:52 +0000
 Translating the new lines to line breaks with HTML  tr
Hi,
  I am using XSLT 1.0 and using is not an option at this time.
I have XML data as below and I need to transform to HTML. I want to insert
line breaks for the DATES field for the new lines while transforming. I tried
to use translate but it only replaces one character with another character.

I am very new to XSL, any suggestion would be great..

Thanks


<?xml version="1.0"?>
<ROWSET>
 <ROW>
  <SEASON_CODE>HIGH</SEASON_CODE>
  <SEASON_DESC>High Season</SEASON_DESC>
  <DATES>Thu 2005-09-01 - Wed 2005-11-30
Fri 2006-09-01 - Sun 2006-12-03
Tue 2011-11-01 - Sat 2011-12-17</DATES>
 </ROW>
...


Desired HTML would be

<html>
<body>
<table border="1">
<tr bgcolor="cyan">
<th>SEASON_CODE</th>
<th>SEASON_DESC</th>
<th>DATES</th>
</tr>
<tr>
<td>HIGH</td>
<td>High Season</td>
<td>Thu 2005-09-01 - Wed 2005-11-30</br>
Fri 2006-09-01 - Sun 2006-12-03</br>
Tue 2011-11-01 - Sat 2011-12-17</td>
</tr>

Current xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
  <body>
   <table border="1">
     <tr bgcolor="cyan">
      <xsl:for-each select="/ROWSET/ROW[1]/*">
       <th><xsl:value-of select="name()"/></th>
      </xsl:for-each>
     </tr>
     <xsl:for-each select="/ROWSET/*">
      <tr>
       <xsl:for-each select="./*">
        <td>  <xsl:value-of select=" text()"/> </td> <!-- I NEED TO DO
SOMETHING HERE -->
       </xsl:for-each>
      </tr>
     </xsl:for-each>
   </table>
   </body>
</html>
  </xsl:template>
</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.