Hey gang!
I thought this may be of use. Pretty old project from College, the code is familiar, but just in case someone is looking.
Program: Apartment Search Database
Language: HTML, XML, XSL, CSS, JavaScript
(1) Save the below in an XML file called
apartmentlist.xmlThis file is linked with web pages in the Apartment Search Database. Be sure to save as
.xml, Save as Type: All Files.
[HTML]
<?xml version="1.0"?>
<!-- File Name: apartmentlist.xml -->
<?xml-stylesheet type="text/xsl" href="ApartmentSearch.xsl"?>
<RENTALUNITS>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>3</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>River Side Apartments</APARTMENT>
<ADDRESS>400 St. Joe River Rd.</ADDRESS>
<PHONE>395-4474</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>White Oak Apartments</APARTMENT>
<ADDRESS>900 W. 111th St</ADDRESS>
<PHONE>398-4123</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>1</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Moore Woods Apartments</APARTMENT>
<ADDRESS>200 N. 1st St.</ADDRESS>
<PHONE>695-0695</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Rhodes Manner Apartments</APARTMENT>
<ADDRESS>1000 Welsh Ave</ADDRESS>
<PHONE>395-3305</PHONE>
<BEDROOMS>4</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
</RENTALUNITS>
[/HTML]
(2) Save this one as another XML file, name it
App_Price.xml
Stick it in a folder called
BEDS. This file is linked with web pages in the Apartment Search Database. Be sure to save as
.xml, Save as Type: All Files.
[HTML]
<?xml version="1.0"?>
<!-- File Name: App_Price.xml -->
<Find_It>
<Apartmnt>
<Name>Konner Ridge</Name>
<Type>Condominium</Type>
<Crime-Rate_1>13 % Low</Crime-Rate_1>
<Crime-Rate_2>26 % High</Crime-Rate_2>
<Your_Price>$189,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Konner Ridge III</Name>
<Type>Apartment Building</Type>
<Crime-Rate_1>23 % Low</Crime-Rate_1>
<Crime-Rate_2>35 % High</Crime-Rate_2>
<Your_Price>$89,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Konner Ridge VI</Name>
<Type>1600 Brick House</Type>
<Crime-Rate_1>10 % Low</Crime-Rate_1>
<Crime-Rate_2>12 % High</Crime-Rate_2>
<Your_Price>$1,600,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Eastwood Place Apartments</Name>
<Type>Brick Mansion</Type>
<Crime-Rate_1>9 % Low</Crime-Rate_1>
<Crime-Rate_2>12 % High</Crime-Rate_2>
<Your_Price>$590,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Blair House</Name>
<Type>Condominium</Type>
<Crime-Rate_1>5 % Low</Crime-Rate_1>
<Crime-Rate_2>10 % High</Crime-Rate_2>
<Your_Price>$2,021,899.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Blair House IV</Name>
<Type>Old Brick House</Type>
<Crime-Rate_1>3 % Low</Crime-Rate_1>
<Crime-Rate_2>8 % High</Crime-Rate_2>
<Your_Price>$678,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>Vorhaus Condos</Name>
<Type>Condominium</Type>
<Crime-Rate_1>11 % Low</Crime-Rate_1>
<Crime-Rate_2>16 % High</Crime-Rate_2>
<Your_Price>$1,189,000.00</Your_Price>
</Apartmnt>
<Apartmnt>
<Name>The French Quarter</Name>
<Type>Condominium</Type>
<Crime-Rate_1>3 % Low</Crime-Rate_1>
<Crime-Rate_2>6 % High</Crime-Rate_2>
<Your_Price>$699,670.00</Your_Price>
</Apartmnt>
</Find_It>
[/HTML]
(3) Add the XSL file, must be named
ApartmentSearch.xslThis file is linked with web pages in the Apartment Search Database. Be sure to save as
.xsl, Save as Type: All Files.
[HTML]
<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
Database search
<center>
<a href="Uhome.html"><img border="0" src="4433444.bmp" alt="Click here to go home"></img></a>
<h2>Browse Availability</h2>
</center>
<xsl:for-each select="RENTALUNITS/LISTING">
<xsl:sort select="APARTMENT" />
<p>
<span style="font-style:italic; font-weight: 900; color: #ff6633">
<xsl:value-of select="ADDRESS" />
</span>
<xsl:text> </xsl:text>
<span style="font-variant:small-caps; font-weight:bold">
<xsl:value-of select="PHONE"/>
</span>
</p>
<p style="margin-left: 3%">
<span style="font-weight:bold">Number of Bedrooms/Baths </span>
<xsl:value-of select="BEDROOMS" /> bedrooms and <xsl:value-of select="BATHS"/> baths.
Number of vacancies:
<span style="font-style:italic; font-weight: bold; color:#009999">
<xsl:value-of select="VACANCY" />
</span>
</p>
</xsl:for-each>
</xsl:template>
</xsl:transform>
[/HTML]
(4) Add a couple of HTML files, this one should be named
apartment.htmlThis file is linked with web pages in the Apartment Search Database. Be sure to save as
.html, Save as Type: All Files.
[HTML]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fetch Bedrooms</title>
</head>
<body bgcolor="gray">
<xml id="dsoRENTALUNITS" src="BEDS/App_Price.xml"></xml>
<p align="center">
<a href="index.htm"><img border="0" src="img_citywide.gif"></img></a></p>
<p></p>
<p style="font-size:24px; color: #332266; font-weight:900">Search By # of Rooms</p>
<p style="font-size:18px; color: white; font-weight:100">Number of Rooms:<input type="text" id="searchtext" size="20" onKeyPress="keyPressed()">
<button onClick="findApp()">search</button>
</p>
<hr size="5" color="#cccccc"/>
<div id="searchresult">
<p style="font-size:18px; color: lime; font-weight:100">Results:
</div>
<script type="text/javascript">
<!--hide from old browsers
function keyPressed(k) {
var hitEnter=event.keyCode
if (hitEnter==13) findApp()
}
function findApp() {
searchstring = searchtext.value.toUpperCase()
if (searchstring=="") {
searchresult.innerHTML = "<b>Please add # of rooms in textbox.</b>"
return
}
dsoRENTALUNITS.recordset.moveFirst()
var outputresult=""
while (!dsoRENTALUNITS.recordset.EOF) {
namestring = dsoRENTALUNITS.recordset("Num_Bed").value
if (namestring.toUpperCase().indexOf(searchstring)>=0 )
outputresult += "<b>" + dsoRENTALUNITS.recordset("Num_Bed")+"</b> ("+dsoRENTALUNITS.recordset("Beds")+")</p>"
+ "<p style='margin-left:25px'><b>Location: </b>"+dsoRENTALUNITS.recordset("Local")+"</p>"
+ "<p style='margin-left:25px'><b>For: </b>"
+ dsoRENTALUNITS.recordset("Option_Bound") +"<br /></p>"
dsoRENTALUNITS.recordset.moveNext()
}
if (outputresult=="")
searchresult.innerHTML = "Number of rooms selected currently unavailable."
else
searchresult.innerHTML = outputresult
}
//-->
</script>
<hr size="5" color="#cccccc" />
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Rooms</a>
</td>
</tr>
</table>
</center>
<br>
<br>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@Me.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@Me.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
[/HTML]
(5) Name below,
apartment_price.htmlThis file is linked with web pages in the Apartment Search Database. Be sure to save as
.html, Save as Type: All Files.
[HTML]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<xml id="dsoApp" src="App_Price.xml"></xml>
<head>
<title>Browse By Price</title>
</head>
<body bgcolor="gray">
<center>
<a href="index.html"><img border="0" src="img_citywide.gif"></img></a>
<h2>Apartment Listing By Price</h2>
<button onclick="AppTable.firstPage()">|< First Page </button>
<button onclick="AppTable.previousPage()">< Previous Page </button>
<button onclick="AppTable.nextPage()"> Next Page > </button>
<button onclick="AppTable.lastPage()"> Last Page >| </button>
<hr color="#666666" size="5" width="75%" />
<table id="AppTable" datasrc="#dsoApp" datapagesize="6" border="1" cellpadding="5">
<thead style="color:darkred; font-size:14pt; font-weight:900">
<th>TYPE</th>
<th>NAME</th>
<th>CRIME RATE</th>
<th>YOUR PRICE</th>
</thead>
<tr>
<td><span datafld="Type" style="font-family:arial; font-style:italic"></span></td>
<td><span datafld="Name" style="font-family:arial; font-weight:900"></span></td>
<td><span datafld="Crime-Rate_1"></span>, <span datafld="Crime-Rate_2"></span></td>
<td><span datafld="Your_Price"></span></td>
</tr>
</table>
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Bedrooms</a>
</td>
</tr>
</table>
</center>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@You.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@You.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
[/HTML]
(6) Here is our
index.htmlThis file is linked with web pages in the Apartment Search Database. Be sure to save as
.html, Save as Type: All Files.
[HTML]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XXXXX, Inc. Apartment Search</title>
</head>
<body bgcolor="gray">
<table border="0" width="90%">
<tr>
<td><div align="center"><p style="font-weight:bold"><center>Welcome our home Page! <br><img src="7666646.gif" /></div>
</tr></td>
</table>
<table border="0" width="90%">
<tr>
<td align="center" width="26%"><img src="ttttetetetet.jpg" usemap="#DatabaseSearchbar"/>
<map name="DatabaseSearchbar">
<area shape="rect" coords="16,90,195,117" href="apartmentlist.xml" alt="Browse Location" />
<area shape="rect" coords="39,131,167,157" href="apartment_price.html" alt="Browse Price" />
<area shape="rect" coords="35,169,173,195" href="apartment.html" alt="Search Bedrooms" />
</map>
</td>
</tr>
</table>
<br>
<table align="center" width="670">
<tr>
<td width="34%">
<a href="apartmentlist.xml">Browse Location</a>
</td>
<td width="34%">
<a href="apartment_price.html">Browse Price</a>
</td>
<td width="32%">
<a href="apartment.html">Search Bedrooms</a>
</td>
</tr>
</table>
<p>
<b><CENTER>
<FONT FACE="Arial" SIZE="-2" color="white">
Copyright © 2006-2008 For more information about our business,<br> please contact us: <a href="mailto:XXXXXXX@You.org"><FONT FACE="Arial" SIZE="-2" color="lightgreen"><b>XXXXXXX@You.org</a></b></font><br> All rights reserved.
<br></CENTER>
</p>
</FONT></b>
</body>
</html>
[/HTML]
Please note: XML Data in this web site were managed through a variety of platforms. An ASP.NET web site allowed data to be added to an SQL Server 2005 database, which were then loaded to an Access Database. A VB application helped make up XML files to load to the above.
Related link: http://bytes.com/forum/thread762010.html Added info: http://bytes.com/forum/thread777267.html
Have fun!
Dököll