For the love of God don't use Javascript to transform XML. You need to be using XSLT:
real.xls:
PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/>
<xsl:template match="rental">
<div class="table">
<div class="heading"><xsl:value-of select="address/suburb" />: <xsl:value-of select="address/streetNumber" /> <span class="street"><xsl:value-of select="address/street" /></span></div>
<div class="house">
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="object/img/@file" /></xsl:attribute>
<xsl:attribute name="alt">Picture of the house</xsl:attribute>
</xsl:element>
<p>Bedrooms: <xsl:value-of select="features/bedrooms" /></p>
<p>Bathrooms: <xsl:value-of select="features/bathrooms" /></p>
<p>Carports: <xsl:value-of select="features/carports" /></p>
</div>
<div class="rent">
$ <xsl:value-of select="rent" /> pw
<div class="description"><xsl:value-of select="description" /></div>
<span class="details">
<xsl:element name="a">
<xsl:attribute name="href"><![CDATA[http://www.yoursite.com/cgi-bin/prog.pl?get=house&id=]]><xsl:value-of select="uniqueID" /></xsl:attribute>
<xsl:attribute name="title">Property details</xsl:attribute>
Details
</xsl:element>
</span>
</div>
<div class="agent">
<xsl:element name="a">
<xsl:attribute name="href"><![CDATA[http://www.yoursite.com/cgi-bin/prog.pl?get=agent&id=]]><xsl:value-of select="agentID" /></xsl:attribute>
<xsl:attribute name="title">Property details</xsl:attribute>
Agent Details
</xsl:element>
</div>
</div>
</xsl:template>
<xsl:template match="residential">
</xsl:template>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Real Estate</title>
<link rel="stylesheet" type="text/css" href="real.css" />
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
real.css:
PHP Code:
.table{
width:700px;
height: 200px;
}
.heading{
clear:both;
}
.street{
padding-left:5px;
}
.house{
float:left;
}
.rent{
float:left;
padding-left: 10px;
}
.description{
overflow: hidden;
width: 300px;
height:98px;
}
real.xml:
PHP Code:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="real.xsl"?>
<propertyList date="2007-01-30-09:18:38" username="console" password="your account password">
<rental modTime="2007-01-30-09:18:38" status="current">
<agentID>45873232</agentID>
<uniqueID>3</uniqueID>
<dateAvailable>2007-01-30T09:18:38.883</dateAvailable>
<rent period="weekly">180</rent>
<address display="yes">
<streetNumber>65</streetNumber>
<street>Figtree Road</street>
<suburb>YOURTOWN</suburb>
<state />
<postcode />
<country>Australia</country>
</address>
<category name="House" />
<headline />
<description>
<![CDATA[
<P>Sundrenched Family Home </P><P></P><P>Spacious 3 bedroom family home featuring separate lounge and dining, open plan gourmet kitchen with dishwasher and gas cooking, polished floors in the living areas, built in robes, main with walk in robe and ensuite bathroom, separate teenagers retreat or home office, single lock up garage. </P>
]]>
</description>
<features>
<bedrooms>4</bedrooms>
<bathrooms>1</bathrooms>
</features>
<objects>
<img id="m" modTime="2007-01-30-09:18:38" file="p3i2.jpg" />
</objects>
</rental>
<residential modTime="2007-01-30-09:18:38" status="current">
<agentID>45873232</agentID>
<uniqueID>7</uniqueID>
<authority value="exclusive" />
<price display="yes">790000</price>
<address display="yes">
<streetNumber>182</streetNumber>
<street>Robertson Court</street>
<suburb>MYTOWN</suburb>
<state />
<postcode />
<country>Australia</country>
</address>
<category name="Townhouse" />
<headline>Expansive Family Residence</headline>
<description>
<![CDATA[
<P>Cascading over four expansive levels, this superb wide fronted (6.1m) terrace sets a new standard in contemporary living and offers a lifestyle of comfort and convenience. </P>
]]>
</description>
<features>
<bedrooms>1</bedrooms>
<bathrooms>2</bathrooms>
<pool type="inground">yes</pool>
</features>
<objects>
<img id="m" modTime="2007-01-30-09:18:38" file="p7i8.jpg" />
</objects>
</residential>
<rental modTime="2008-04-20-09:18:38" status="current">
<agentID>45873232</agentID>
<uniqueID>4</uniqueID>
<dateAvailable>2007-01-30T09:18:38.883</dateAvailable>
<rent period="weekly">240</rent>
<address display="yes">
<streetNumber>24</streetNumber>
<street>Some Road</street>
<suburb>ATOWN</suburb>
<state />
<postcode />
<country>Australia</country>
</address>
<category name="House" />
<headline />
<description>
<![CDATA[
<P>Supurb Family Home </P><P></P><P>Ideal for the large family, this spacious six bedroom family home is located on five acres of lan just outside of town. All the bedrooms have built-in robes. The main bedroom has an ensuite and the other two bathrooms are located near the other rooms. The house fetures a large deck overlooking the mighty Aver River. </P>
]]>
</description>
<features>
<bedrooms>6</bedrooms>
<bathrooms>3</bathrooms>
</features>
<objects>
<img id="m" modTime="2008-04-20-09:18:38" file="p4i4.jpg" />
</objects>
</rental>
</propertyList>
Note the reference to the stylesheet at the top of the xml document.
I've left the css pretty simple just so you get the general idea of what to do and so that you can style it to your requirements.
If you have any questions let me know ;)
Regards
Carl