This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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