Embedding css in xslt

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am sending some information via email with body as html<br/>
<br/>
In that body i am transforming some data via dataset into my required info<br/>
<br/>
What i needed is that there should be some css should also be added there<br/>
<br/>
As this is going in email i cant reference external css style sheet.So i wanted to embed the css in
<br/>
my xslt<br/>

Both xslt and css are given below<br/>

<pre class="prettyprint
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform
<xsl:output method="html" version="1.0" encoding="UTF-16" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/
<html xmlns="http://www.w3.org/1999/xhtml
<head>
<span style="text-decoration:underline wanted to put css
</head>
<body>
<table align="center" width="1024" cellpadding="0" cellspacing="0
<tr>
<td>
<table align="center" width="100%" cellpadding="0" cellspacing="0" >
<tr>
<td>
<h3 class="h3
My Heading
</h3>
</td>
</tr>
<tr>
<td>
<xsl:fallback xml:space="default
</xsl:fallback>
<xsl:apply-templates />
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="NewDataSet

<xsl:if test="TestInfo
<br />
<table border="0" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" colspan="1"
width="100%
<tr>
<td class="lang-heading
Location
</td>
<td class="lang-heading
ABCColumn
</td>
<td class="lang-heading
"XYZ
</td>
</tr>
<xsl:apply-templates select="TestInfo" />
</table>
</xsl:if>

</xsl:template>
<!-- ................................................-->
<xsl:template match="TestInfo
<tr>
<xsl:value-of select="Location" />
</td>
<td class="item-values
<xsl:value-of select="ABCColumn" />
</td>
<td class="item-values
<xsl:value-of select="XYZ" />
</td>
</tr>
</xsl:template>
</xsl:stylesheet>

[/code]
<br/>
<br/>

<pre class="prettyprint





h3.h3
{
padding-left: 5px;
}


td.lang-heading
{
font-family: Verdana;
font-size: 10pt;
font-weight: bold;
color: Black;
vertical-align: top;
margin-left: 10px;
margin-right: 10px;
border-bottom: 1px solid Black;
}

td.lang-values-left
{
background-color: #BFDCE0;
}


td.item-values
{
font-family: Verdana;
font-size: 10pt;
color: Black;
vertical-align: top;
border-bottom: 1px solid Black;
}

.grid-bg-0
{
background-color: white;
}
.grid-bg-1
{
background-color: #D9F1F5;
}
h3.h3
{
padding-left: 5px;
}


td.lang-heading
{
font-family: Verdana;
font-size: 10pt;
font-weight: bold;
color: Black;
vertical-align: top;
margin-left: 10px;
margin-right: 10px;
border-bottom: 1px solid Black;
}

td.lang-values-left
{
background-color: #BFDCE0;
}


td.item-values
{
font-family: Verdana;
font-size: 10pt;
color: Black;
vertical-align: top;
border-bottom: 1px solid Black;
}

.grid-bg-0
{
background-color: white;
}
.grid-bg-1
{
background-color: #D9F1F5;
}
[/code]
<br/>
<hr class="sig Kamran Shahid Principle Engineer Development (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web])

View the full article
 
Back
Top