Jump to content

CSS in XSL


kvnmck18

Recommended Posts

Can you have CSS in XSL? I know you can in IE...but does not work in Mozilla and I'm sure it doesn't in other browsers... how can you?

Link to comment
Share on other sites

What are you talking about? It works in FF and Opera 9 too. Perhaps your XHTML output wasn't actually valid, so that's why you got some inconsistences. Show me the code you've tested.

Link to comment
Share on other sites

<?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="/"><head><style type="text/css">body {font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px}table {margin:0;padding:0;border:0;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px}td {margin:0;padding:2px;padding-left:10px;padding-right:10px;border:0;border-bottom:1px solid #000}td.two {margin:0;padding:2px;padding-left:10px;padding-right:10px;border:0;border-bottom:1px solid #000;background-color:#CCC}td.right {margin:0;padding:0;border:0;padding-left:10px;border-bottom:1px solid #000;border-left:1px solid #000}td.right2 {margin:0;padding:0;border:0;padding-left:10px;border-bottom:1px solid #000;border-left:1px solid #000;background-color:#CCC}tr {margin:0;padding:0;border:0}</style></head><html><body><table border="0" cellspacing="0" width="100%"><xsl:for-each select="images/pic"><tr><td width="100%"><xsl:variable name="thumbs" select="thumbnail"/><img src="{$thumbs}" /></td></tr></xsl:for-each></table><table border="0" cellspacing="0"><xsl:for-each select="images/pic"><tr><td class="right2" valign="top" align="center"><xsl:variable name="srcl" select="leftpic"/><xsl:variable name="srcr" select="rightpic"/><img src="{$srcr}" /><img src="{$srcl}" /> <br /><xsl:value-of select="description"/></td></tr><tr><td height="20px"></td></tr></xsl:for-each></table></body></html></xsl:template></xsl:stylesheet>

Link to comment
Share on other sites

Is this even displaying anywhere? Try to move the <html> element right after the <xsl:template match="/"> tag. Currently, your XSLT itself is invalid.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...