This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes learn xsl to html creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "learn xsl to html creation" Watch "learn xsl to html creation" New topic
Author

learn xsl to html creation

amit k bhardwaj
Greenhorn

Joined: Jul 29, 2010
Posts: 3
this is a excellent code to under xsl to html transformation

:: all code is self expalnatory

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" indent = "yes"/>
<xsl:template match="/">
<html>
<head>
</head>
<body>
<h1><I><xsl:value-of select= "content/entity/@name"/></I></h1>
<hr/>
<font color='#888888'>
<xsl:value-of select= "content/entity/country"/>
>
<xsl:value-of select= "content/entity/sector"/>
</font>
<br/>
<br/>
<xsl:for-each select="content/ratingCategory">
<xsl:if test = "@ratingTypeCode = 'ICR'">
<xsl:if test = "rating/name= 'Final'">
<xsl:choose>
<xsl:when test = "not(rating/creditWatch = 'Y')">
<b><font color='blue'><center><xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/></center></font></b>
</xsl:when>
<xsl:when test = "rating/creditWatch = 'Y'">
<center>CW:<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/></center>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:if>
</xsl:for-each>
<br/>
<p><xsl:value-of select= "content/comments"/></p>
<br></br>
<b><table border="1" align='center'>
<tr><th></th><th><b><font color='#009900'>Existing</font></b></th><th><b><font color='#009900'>Recommended</font></b></th><th><b><font color='#009900'>Final</font></b> </th></tr>
<xsl:for-each select="content/ratingCategory">
<tr>
<td><b><font color='#A80000'><xsl:value-of select = "@ratingTypeName"/></font></b></td>
<td align='center'>
<xsl:if test = "rating/name = 'Existing'">
<xsl:choose>
<xsl:when test = "not(rating/creditWatch = 'Y')">
<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
<xsl:when test = "rating/creditWatch = 'Y'">
CW:<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</td>
<td align='center'>
<xsl:if test = "rating/name = 'Recommended'">
<xsl:choose>
<xsl:when test = "not(rating/creditWatch = 'Y')">
<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
<xsl:when test = "rating/creditWatch = 'Y'">
CW:<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</td>
<td align='center'>
<xsl:if test = "rating/name = 'Final'">
<xsl:choose>
<xsl:when test = "not(rating/creditWatch = 'Y')">
<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
<xsl:when test = "rating/creditWatch = 'Y'">
CW:<xsl:value-of select = "rating/outlook"/> / <xsl:value-of select = "rating/ratingCode"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
</b>
<br/>
<br/>
<b>
<P align="left">Recommended By:
<br></br>
<br/>
Chairman :
<xsl:for-each select="content/entity/committeeMember/memberInfo">
<xsl:if test = "role = 'chairman'">
<xsl:value-of select = "@name"/>
</xsl:if>
</xsl:for-each>
<br/>
Voters :
<xsl:for-each select="content/entity/committeeMember/memberInfo">
<xsl:if test = "role = 'voter'">
<xsl:value-of select = "@name"/>;
</xsl:if>
</xsl:for-each>
</P>
</b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: learn xsl to html creation
 
Similar Threads
Cross Browser Compatibility Issues
Code Allignment In Xml Spy Editor
How to get XSL table with alternating rows highlighted
Remove unwanted space before and after the table using javascript
Handling Nested tables in xsl:fo for saving a document in RTF