brokeanheartt
New Member
To be honest this is my first XML project, but I've finally grown tired of looking up the answer on my own. I'm trying to create an address book, having the contacts data saved in an XML file and pulled from the transformed XSLT style sheet to produce a simple table. Here's a copy of my files, help will be much appreciated. Thanks.XML:\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/12443806/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\]and my XSLT:\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/css" href="http://stackoverflow.com/questions/12443806/sitetemplate.css"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><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:for-each select="addressbook/contact"> <tr> <td><xsl:value-of select="fname"/></td> <td><xsl:value-of select="lname"/></td> <td><xsl:value-of select="mi"/></td> <td><xsl:value-of select="staddress"/></td> <td><xsl:value-of select="city"/></td> <td><xsl:value-of select="state"/></td> <td><xsl:value-of select="zip"/></td> <td><xsl:value-of select="phone"/></td> <td><xsl:value-of select="email"/></td> <td><xsl:value-of select="twitter"/></td> </tr> </xsl:for-each></table></body></html></xsl:template></xsl:stylesheet>\[/code\]Also I'd like to mention that as of how the code is written now that my first row is produced, but my table just stops afterwards.