Reputation: 237
I have an XSL file and a CSS file, to display my XML, but I can't seem to get the CSS to take effect and not sure why it won't display with the CSS, is just showing all text normally.
h1
{
background-color:black;
color:#A901DB;
text-align:center;
padding:20px;
float:center;
width:1000px;
font-family:"Lucida Sans Unicode";
}
XSL
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="BlogCSS.css"/>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="blogPost">
<p>
<xsl:apply-templates select="blogTitle"/>
</p>
</xsl:template>
<xsl:template match="blogTitle">
<h1>
<xsl:value-of select="."/>
</h1>
<br/>
</xsl:template>
</xsl:stylesheet>
XML file has the line and it's displaying all the information in the XML file it's just not applying the CSS too it.
Thanks.
Upvotes: 0
Views: 116
Reputation: 24637
Use the XHTML namespace in the top level tag:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
>
Upvotes: 1