Hi all,
I've been working on a project to display a list of names and contact information based on an XML file generated through a web service. But I can't for the life of me read data using my XSL file, even though it looks to be dead on based on the web examples I've been using.
Here's the XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Data xmlns="http://www.domain.com/schema/data" xmlns:dmd="http://www.domain.com/schema/data-metadata" dmd:date="2008-09-17">
<Record userId="56103" username="smithj" dmd:sId="17777">
<dmd:IndexEntry indexKey="DEPARTMENT" entryKey="Management" text="Management"/>
<dmd:IndexEntry indexKey="COLLEGE" entryKey="Business" text="Business"/>
<INFORMATION id="334635008" dmd:lastModified="2008-07-19T16:26:50">
<DPHONE1/>
<FAX1/>
<WEBSITE>http://</WEBSITE>
<PREFIX/>
<FNAME>Joe</FNAME>
<PFNAME/>
<LNAME>Smith</LNAME>
<EMAIL>[email protected]</EMAIL>
</INFORMATION>
</Record>
</Data>
And here's the XSL file:
Code:
<?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="/">
<html>
<head>
<title>My Title</title>
</head>
<body>
<p>Text in body tag...</p>
<xsl:for-each select="Data/Record/INFORMATION">
<p><b>Test: <xsl:value-of select="FNAME"/></b></p>
</xsl:for-each>
<p>Text in body tag...</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I'm using PHP's XSLTProcessor() to handle the actual transform and using XAMPP (Apache, PHP, etc) as my server. Based on what I'm seeing, the stuff above should show "Joe" in the browser. But I can't get anything to show at all from inside the for-each loop block. Am I doing something wrong?
Any help would be appreciated.
Thanks,
- Matt