Newbie question on the xsl file

C

Cardinal

I'm just learning xml and have successfully displayed an xml page with
its accompanying XSL Style Sheet. The style sheet code is listed
below.

**************************************************

<?xml version="1.0" encoding="ISO-8859-1" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>

<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>

</xsl:template>
</xsl:stylesheet>

**************************************************

Can someone please tell me where I would put the font information if I
wanted to display the table in Arial 10 for example? Thanks very much.
 
H

Helge Rex

You can use a separate css file.


<?xml version="1.0" encoding="ISO-8859-1" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head>
<meta http-equiv="content-style-type" content="text/css" />
<link rel="stylesheet" href="cd.css" />
</head>
<body>
<h2>My CD Collection</h2>
<table>
<tr>
<th>Title</th>
<th>Artist</th>
</tr>

<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

file cd.css:

h2 {
}

table {
border:1px inset;
width:75%;
}

td {
border:1px groove;
font-family:Arial, Sans Serif;
font-size:14px;
}

th {
background-color:#9ACD32;
border:1px groove;
font-family:Times New Roman, Serif;
font-size:14px;
font-weight:bold;
text-align:center;
}

(german) WebDevel site:
http://selfhtml.teamone.de/navigation/syntax.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top