Using CSS to display XSTL table

ezra339

New Member
Okay so I've been having trouble with my first XML project, so I've turned to you guys. I'm trying to produce an address book using an XML file that contains the contacts data, that is then transformed in XSLT. Both the XML and XSLT files work correctly, but my problem begins when I try to implement my CSS file into the XSLT so I can format the page to match the rest of the website. Once the CSS is implemented, my table only shows the first row given in the XSLT and stops. Given below is the code for my three files, and the given response with the CSS file included.XML: \[code\]<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/12449497/contactdata.xsl"?><!DOCTYPE addressbook [<!ELEMENT addressbook (contact)><!ELEMENT contact (fname,lname,mi,staddress,city,state,zip,phone,email,twitter)><!ELEMENT fname (#PCDATA)><!ELEMENT lname (#PCDATA)><!ELEMENT mi (#PCDATA)><!ELEMENT staddress (#PCDATA)><!ELEMENT city (#PCDATA)><!ELEMENT state (#PCDATA)><!ELEMENT zip (#PCDATA)><!ELEMENT phone (#PCDATA)><!ELEMENT email (#PCDATA)><!ELEMENT twitter (#PCDATA)>]><addressbook><contact><fname>Peyton</fname><lname>Manning</lname><mi>Z</mi><staddress>123 Go Vols</staddress><city>Denver</city><state>CO</state><zip>12345</zip><phone>1-800-youwish</phone><email>[email protected]</email><twitter>peyton_manning</twitter></contact><contact><fname>Eric</fname><lname>Berry</lname><mi>P</mi><staddress>123 Arrowhead Stadium</staddress><city>Kansas City</city><state>MO</state><zip>34567</zip><phone>816-213-4452</phone><email>[email protected]</email><twitter>eric_berry</twitter></contact></addressbook>\[/code\]XSLT: \[code\]<?xml-stylesheet type="text/css" href="http://stackoverflow.com/questions/12449497/sitetemplate.css"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="/*"> <html> <body> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Middle Initial</th> <th>Street Address</th> <th>City</th> <th>State</th> <th>Zip</th> <th>Phone</th> <th>Email</th> <th>Twitter</th> </tr> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="contact"> <tr><xsl:apply-templates/></tr> </xsl:template> <xsl:template match="contact/*"> <td><xsl:value-of select="."/></td> </xsl:template></xsl:stylesheet>\[/code\]CSS: \[code\].text {font-family: Helvetica, Times, serif; color:white;}.center {text-align:center;}body {background-image:url('wallpaper.jpg'); font-family: Helvetica, Times, serif;}hr {border: 0; width: 50%; color:white;}table, th, td {border:10px white; background-color:blue; color:white;} a:link {color:#75B8FA; text-decoration:none;}a:visited {color:#75B8FA; text-decoration:none;}a:hover {color:#75B8FA; text-decoration:none;}a:active {color:#FFFFFF; text-decoration:none;}\[/code\]And what is shown on the browser when trying to run: http://i144.photobucket.com/albums/r171/jmock89/giventable.png(Sorry it's an outside link, I can't post images on StackOverflow until I have 10 rep.)
 
Back
Top