473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

different webpages-1database

hey,
I have a huge database (MySQL), and now I want to display that
information
on my website. I want to organize it in such way that the user can say
what he wants to see.
For example, only cd's from the years 2000, or all books from author
x, ...
I'v looked around on the net, and this is what I came up with:
use a script that returns xml, use xslt to extract the wanted
information out of the xml, in the right order, formatted in the
wanted manner.
But now the problem:
can I do all of this with 1 script? (I prefer perl),
how do I generate the xml file?
do I use parameters or is there an other way (and so, how should this
be organized)
What about performance?

An example can help me a lot, a prototype or something.
....

Lots of questions, so waiting for lots of answers.

THANKS
Jul 20 '05 #1
1 1342
On 21 Jan 2005 03:49:41 -0800, Pi*******@hotmail.com (Piet L.) wrote:
can I do all of this with 1 script? (I prefer perl),
Yes, easily. You will use multiple XSLT files to get the variation
between sites or page types. The "script" that executes the transform
can be very static.
how do I generate the xml file?
Pretty easy - query the database, walk through the rows and append
them to a DOM. The use the DOM to write out an XML document (if you
want to store it) or keep the DOM in memoy and apply XSLT to it
directly.

Don't write your own XML serializer (i.e. print statements to a file)
- use a DOM instead. You don't even _need_ a serializer, unless it's
for some caching or debug purposes. The DOM will give you an XML
document in memory and the XSLT transform can operate on it there.
do I use parameters or is there an other way (and so, how should this
be organized)
You shouldn't have much need for them. Parameterise the SQL queries
(although this is hard in MySQL, for something with the compelxity of
a search - you'll need to emulate SQL stored procs in the Perl layer).

Beyond that point the XSLT can usually be fairly parameter free. If
you need some, they're often best supplied through the XML source
document, not by setting param values on the stylesheet.

What about performance?
Use XSLT to format and _maybe_ sort, but don't use it to filter. Have
the database do that.

Always know what you're doing. XSLT is a declarative language (sic)
and those are infamous for involving huge numbers of clock cycles to
execute an apparently simple task. I've seen XML-based systems that
pulled 20MB of XML from a database, just so as to allocate a new ID
number by counting to three and adding one ! Keep you eye on that
designed architecture, the data flows and don't just let the code
write itself.

XSLT transformations themselves are fast and efficient. Loading and
parsing XML documents from files, and _especially_ loading XSLT
documents into a transform engine are slow. Good efficiency at this
point depends on caching the loaded XSLT stylesheets between pages (I
have no idea how to do this with mod_perl). Unless there's much
searching or filtering going on, it may also be worth caching some XML
intermediate documents.

An example can help me a lot, a prototype or something.


Sorry, that's more Perl than I know.
Don't write your own XML serializer. Really. I'm sick of seeing
people screw projects up by doing this.
--
Smert' spamionam
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Walker | last post by:
Hi I have a Microsoft SQL database I can use (also mySQL, so if you know how to do this in mySQL that is just as useful). The database can only be accessed from webpages hosted on the same server...
16
by: Geoff Cox | last post by:
Hello, I publish some web pages using large fonts and would like to give the user the opportunity to print the pages using a smaller font. I believe that this is possible using different style...
7
by: dow | last post by:
I'm looking for ideas or how to make webpages for members. I want a member log in and view their profiles and check boxes stating that they have completed listed instructions and waiting for the...
5
by: Michael Landberg | last post by:
Hi this may be a stupid question, but anyway! I have created a website with a few pages. I have noticed that when I change the IE browser text size ( through the view menu -> text size) to...
0
by: xmail123 | last post by:
I have written the following simple C# project in Visual studio. I am trying to see how the XML documenting works. I click Tools, Build Comment WebPages… then just click OK in the Build Comment...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
1
by: Chandra | last post by:
Hi, Can I drag and drop html contents (DIV/Table) between 2 different webpages? I am able to do it in a single webpage by using the mouse events, but want to extend it for different webpages. ...
7
by: Patricia Mindanao | last post by:
I have a directory tree on my hard disc which represents all the web pages and linked stuff on my mirrored web hoster server. All web pages and files are statically linked. So dynamically...
6
by: greynium | last post by:
hi Please see http://thatshindi.oneindia.in in Firefox and IE7. The spacing between the lines are different. What we see in Firefox is what we desire. How do we fix things to make it look...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.