Subject: XSL/HTML styling and CSS style sheets
From: "Jackson Zettler" <jacksonzettler@xxxxxxxx>
Date: Thu, 4 Dec 2003 09:42:10 -0500
|
Hello,
I am a newbie to XSL. ?My first XSL project is to try to turn one of my html
pages into an XML/XSL page and I am trying to figure out how to make my page
look the same way it did when it was just html.? I was kinda hoping that I
could just embed my CSS the same way I used to in the html page:
<link rel="stylesheet" type="text/css" href="/styles.css">
But this doesn?t work.
What is the best way to style my XSL page? ?I have been playing around with
templates and xsl-attributes but it seems like I should just be able to use
my old CSS?s to style the page.
Can I do this?? How do I do this?? If not what should I be doing?
I?ve included my XSL document.? As of now I?m just moving little parts of
the html page in to see what I can get working and looking the same as it
did before.
I am also having a problem with non-regular ascii characters displaying in
the browser as you can see in the data below; this is transferred to the
browser and is never translated for display.
XML:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/fdm4styles/drill-down2.xsl"?>
<page>
?<product parent="8715">
??<description>Georgian Oil Color Introduction Set</description>
? <vendor>Daler-Rowney</vendor>
?</product>
?<product>
? <description>Georgian Oil Colors</description>
? <vendor>Daler-Rowney</vendor>
? <subproduct parent="501">
? ?<description>38 ml. Tubes</description>
? </subproduct>
? <subproduct parent="501">
? ?<description>225 ml. Tubes</description>
? </subproduct>
? <subproduct parent="501">
? ?<description>115 ml. Tubes</description>
? </subproduct>
?</product>
?<product parent="2004">
? <description>Georgian Oil Painting BeginnerÂ? s Set</description>
? <vendor>Daler-Rowney</vendor>
?</product>
</page>
XSL:
<xsl:stylesheet version="1.0"
??????????????? xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
??????????????? xmlns:fo ="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
?<head>
? <title>TEST</title>
?</head>
?<body>
? <table border="0" width="617" cellpadding="0" cellspacing="0">
?? <tr>
??? <td>
???? <table border="1" width="100%" cellpadding="0" cellspacing="0">
?
????? <tr>
?????? <td align="center" colspan="2">Found Products</td>
????? </tr>
????? <tr><td height="10" colspan="2"></td></tr>
????? <xsl:for-each select="page/product">
????? <tr>
?????? <xsl:if test="position() mod 2 = 0">
??????? <xsl:attribute name="bgcolor">lightgrey</xsl:attribute>
?????? </xsl:if>
??
?????? <td width="33%"><xsl:apply-templates select="vendor"/></td>
?????? <td><xsl:apply-templates select="description"/></td>?????
????? </tr>
????? </xsl:for-each>
???? </table>
??? </td>
?? </tr>
? </table>
?</body>
</html>
</xsl:template>??
??
<xsl:template match="vendor">
? <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="description">
?<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Jackson
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|