LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-21-2009, 09:59 AM   #1
esteeven
Senior Member
 
Registered: Oct 2001
Location: Bristol UK
Distribution: Arch Slackware Ubuntu
Posts: 1,082

Rep: Reputation: 52
filtering XML using XSLT via drop down box


Hello
I have an XML file of rental houses for display on a property lettings website. The data is relatively simple e.g. number of rooms, address, price.

Initially, I was hoping to import the XML data into a MYSQL database and filter using PHP but that suddenly seems like overkill : the XML list currently contains only 7 properties to list. The average number of properties is around 15. The maximum number ever was 41!!

Is it possible to filter the data directly from the XML file using an on page drop down box and display only the filtered results on the page? My client would like site users to be able to specify the number of rooms they want and see only those properties or view properties by a price range.

I know that 7 properties can easily be displayed on one page. In fact, in most cases, all of the properties could more or less be on one page. I suppose my client is thinking of the rare times when there are 40 o more properties.

Thanks in advance!
 
Old 08-22-2009, 10:42 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hi esteevan,

No reason you cant, I created a dashboard view for BackupExec using perl to generate xml data, heres an excerpt from the .xslt :

---------------------------------------------
<xsl:sort select="server_name"/>
<xsl:choose>
<xsl:when test="contains(job_status, '5') or contains(job_status, '19')">
<tr bgcolor="#9acd32">
<td><xsl:value-of select="server_name"/></td>
<td><xsl:value-of select="job_name"/></td>
<td><xsl:value-of select="job_status"/></td>
<td><xsl:value-of select="start_date"/></td>
<td><xsl:value-of select="time_started"/></td>
<td><xsl:value-of select="bytes_processed"/></td>
<td><xsl:value-of select="elapsed_time"/></td>
<td><a href="{job_log_full_path}">Click here</a></td>
</tr>
</xsl:when>
---------------------------------------------

cheers,

kbp
 
Old 08-22-2009, 12:23 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Sometimes, the size of the database is irrelevant to the complexity. Determining whether to use a relational (or other) database engine may very well depend on the relations and logic that you need to apply to the data/problem. Query actions on a dataset is tricky code to write, and the difficulty is the same whether your dataset is large or small. If the option to use a RDMS is there, and if it simplifies the job or makes the finished product better (and how will you know when it is 'finished'?), then I suggest that you consider using it. When you start to use the system, you will probably find that you want to add features or make changes, and leveraging the flexibility of a DBMS will facilitate that.

--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting XML attribute using parameter in XSLT mohtasham1983 Programming 2 01-03-2008 04:03 PM
LXer: Expand OpenOffice with XSLT and rich text XML LXer Syndicated Linux News 0 10-11-2007 11:30 PM
XSLT transformation of XML document using XMLNS Foomajick Programming 7 10-25-2006 05:27 AM
XSLT/xml enforcing full tag syntax bigearsbilly Programming 2 11-23-2005 02:38 AM
ePlease help-> XML, XSLT James Clarkes XT software Al Bundy Linux - Software 0 04-21-2003 06:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration